From 9f09f7be89761260d137d6824c88e6829660fdb9 Mon Sep 17 00:00:00 2001 From: Guillaume MASSON Date: Fri, 18 Aug 2023 11:30:08 +0200 Subject: [PATCH] [16.0][FIX] openupgrade_framework : end-migration scripts are forced to run at install too Fixes OCA/OpenUpgrade#4106 --- openupgrade_framework/odoo_patch/odoo/modules/migration.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/openupgrade_framework/odoo_patch/odoo/modules/migration.py b/openupgrade_framework/odoo_patch/odoo/modules/migration.py index 872f84817eb2..2ceda215d03d 100644 --- a/openupgrade_framework/odoo_patch/odoo/modules/migration.py +++ b/openupgrade_framework/odoo_patch/odoo/modules/migration.py @@ -15,9 +15,14 @@ def migrate_module(self, pkg, stage): to_install = pkg.state == "to install" if to_install: pkg.state = "to upgrade" + load_state_to_install = getattr(pkg, "load_state", False) + if load_state_to_install == "to install": + pkg.load_state = "to upgrade" MigrationManager.migrate_module._original_method(self, pkg, stage) if to_install: pkg.state = "to install" + if load_state_to_install == "to install": + pkg.load_state = "to install" migrate_module._original_method = MigrationManager.migrate_module