From d3b5e17d06770872a0ab3424329061b156c02455 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miquel=20Ra=C3=AFch?= Date: Thu, 9 Mar 2023 16:28:33 +0100 Subject: [PATCH] [OU-FIX] account_payment_order: refactor migration script --- .../migrations/15.0.2.0.0/post-migration.py | 3 +++ .../migrations/15.0.2.0.0/pre-migration.py | 8 ++++++++ 2 files changed, 11 insertions(+) create mode 100644 account_payment_order/migrations/15.0.2.0.0/pre-migration.py 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 be62ed2ab..173de3d86 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 @@ -177,3 +177,6 @@ def migrate(env, version): ) _delete_hooks(env) _insert_payment_line_payment_link(env) + openupgrade.delete_records_safely_by_xml_id( + env, ["account_payment_order.bank_payment_line_company_rule"] + ) 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 new file mode 100644 index 000000000..ec25c07e9 --- /dev/null +++ b/account_payment_order/migrations/15.0.2.0.0/pre-migration.py @@ -0,0 +1,8 @@ +# Copyright 2023 ForgeFlow S.L. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from openupgradelib import openupgrade + + +@openupgrade.migrate() +def migrate(env, version): + openupgrade.remove_tables_fks(env.cr, ["bank_payment_line"])