mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[OU-FIX] account_payment_order: Don't execute on DB cleaned up
If v14 database has been cleaned up before migrating to v15, these scripts will fail, as the checks are not taking into account this possibility. This commit adds such possibility.
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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"])
|
||||
|
||||
Reference in New Issue
Block a user