[MIG+IMP] account_asset_management: Use other column for running migration scripts

Old versions of account_asset module contains a parent_id column for assets, which
triggers this migration scripts, but giving error later, as the expected data is
not there (only account_asset_management module contains it), so we use another
column for detecting the condition.
This commit is contained in:
Pedro M. Baeza
2020-02-28 10:47:51 +01:00
parent d969d445f8
commit 666012dd02
2 changed files with 2 additions and 2 deletions

View File

@@ -78,7 +78,7 @@ def update_asset_group_links(cr):
@openupgrade.migrate()
def migrate(env, version):
column = openupgrade.get_legacy_name('parent_id')
if openupgrade.column_exists(env.cr, 'account_asset', column):
if openupgrade.column_exists(env.cr, 'account_asset_profile', column):
# if migrating directly from v11 `account_asset` module, there are no
# view assets nor parents
create_asset_groups(env.cr)

View File

@@ -32,7 +32,7 @@ def move_view_assets(cr):
@openupgrade.migrate()
def migrate(env, version):
if openupgrade.column_exists(env.cr, 'account_asset', 'parent_id'):
if openupgrade.column_exists(env.cr, 'account_asset_profile', 'parent_id'):
# if migrating directly from v11 `account_asset` module, there are no
# view assets nor parents
openupgrade.rename_columns(env.cr, _column_renames)