diff --git a/account_payment_order/migrations/15.0.2.0.0/post-migration.py b/account_payment_order/migrations/15.0.2.0.0/post-migration.py index 173de3d86..b9ae90b0a 100644 --- a/account_payment_order/migrations/15.0.2.0.0/post-migration.py +++ b/account_payment_order/migrations/15.0.2.0.0/post-migration.py @@ -162,9 +162,13 @@ def _insert_payment_line_payment_link(env): @openupgrade.migrate() def migrate(env, version): - if openupgrade.column_exists(env.cr, "account_payment", "old_bank_payment_line_id"): - # No execution if the column exists, as that means that this DB comes from v14 - # with the refactoring already applied + if not openupgrade.table_exists( + env.cr, "bank_payment_line" + ) or openupgrade.column_exists( + env.cr, "account_payment", "old_bank_payment_line_id" + ): + # No execution, as that means that this DB comes from v14 with the refactoring + # already applied and possibly database cleaned up return openupgrade.logged_query( env.cr, "ALTER TABLE account_payment ALTER move_id DROP NOT NULL" diff --git a/account_payment_order/migrations/15.0.2.0.0/pre-migration.py b/account_payment_order/migrations/15.0.2.0.0/pre-migration.py index ec25c07e9..d4907fccf 100644 --- a/account_payment_order/migrations/15.0.2.0.0/pre-migration.py +++ b/account_payment_order/migrations/15.0.2.0.0/pre-migration.py @@ -5,4 +5,6 @@ from openupgradelib import openupgrade @openupgrade.migrate() def migrate(env, version): + if not openupgrade.table_exists(env.cr, "bank_payment_line"): + return # if coming from 14.2.0.0 openupgrade.remove_tables_fks(env.cr, ["bank_payment_line"])