mirror of
https://github.com/OCA/bank-statement-import.git
synced 2025-01-20 12:37:43 +02:00
[OU-FIX] account_statement_import_online: Conditional renaming + filling
As the changes for having online raw data have been made only on v12 and v14, people coming from v13 won't have this column populated on the DB, so we need to be tolerant with that circumstance.
This commit is contained in:
@@ -7,9 +7,11 @@ from openupgradelib import openupgrade
|
|||||||
|
|
||||||
@openupgrade.migrate()
|
@openupgrade.migrate()
|
||||||
def migrate(env, version):
|
def migrate(env, version):
|
||||||
openupgrade.logged_query(
|
column = openupgrade.get_legacy_name("online_raw_data")
|
||||||
env.cr,
|
if openupgrade.column_exists(env.cr, "account_bank_statement_line", column):
|
||||||
"UPDATE account_bank_statement_line SET raw_data={online_raw_data}".format(
|
openupgrade.logged_query(
|
||||||
online_raw_data=openupgrade.get_legacy_name("online_raw_data")
|
env.cr,
|
||||||
),
|
"UPDATE account_bank_statement_line SET raw_data={online_raw_data}".format(
|
||||||
)
|
online_raw_data=column,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ _column_renames = {
|
|||||||
|
|
||||||
@openupgrade.migrate()
|
@openupgrade.migrate()
|
||||||
def migrate(env, version):
|
def migrate(env, version):
|
||||||
if not version:
|
if openupgrade.column_exists(
|
||||||
return
|
env.cr, "account_bank_statement_line", "online_raw_data"
|
||||||
openupgrade.rename_columns(env.cr, _column_renames)
|
):
|
||||||
|
openupgrade.rename_columns(env.cr, _column_renames)
|
||||||
|
|||||||
Reference in New Issue
Block a user