Automatic Update form OCA2FC Migrator

This commit is contained in:
Flectra Community Bot 2021-10-10 02:10:21 +00:00 committed by OCA2FC Migrator Bot
parent bab98bc024
commit 2f8d2cf950

View File

@ -16,16 +16,22 @@ def migrate(env, version):
""" """
old_move_type_column = "move_type" old_move_type_column = "move_type"
new_move_type_column = "financial_type" new_move_type_column = "financial_type"
move_model_name = "account.move"
move_table_name = "account_move" move_table_name = "account_move"
enterprise_move_type_rename = "move_type_custom" enterprise_move_type_rename = "move_type_custom"
ou_move_type_rename = openupgrade.get_legacy_name(old_move_type_column) ou_move_type_rename = openupgrade.get_legacy_name(old_move_type_column)
for move_type_rename in (enterprise_move_type_rename, ou_move_type_rename): for move_type_rename in (enterprise_move_type_rename, ou_move_type_rename):
if openupgrade.column_exists(env.cr, move_table_name, move_type_rename): if openupgrade.column_exists(env.cr, move_table_name, move_type_rename):
openupgrade.rename_columns( openupgrade.rename_fields(
env.cr, env,
{ [
move_table_name: [(move_type_rename, new_move_type_column)], (
}, move_model_name,
move_table_name,
move_type_rename,
new_move_type_column,
),
],
) )
break break