mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
[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:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user