From 64ae832a8ae04ad86b7707e507b71ab612bce87e Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Tue, 28 Apr 2020 08:53:48 +0000 Subject: [PATCH] [FIX] base: allow uninstall of modules to upgrade Commit 8c1bb22ec0222dca652e0649454b986c06cb1368 forgot to take into account migrations, during a migration it is possible that some modules need to be uninstalled because the target version may have removed / moved them and since during a migration all modules are set `to upgrade`, the previous condition made this impossible for migration scripts that use the ORM for module uninstalls (not Odoo's case, mind you) With this commit it is again possible to uninstall modules from a migration script during a migration. closes odoo/odoo#50322 X-original-commit: a7c90a6d080a77316924cec9d3c64f9662ac7436 Signed-off-by: Raphael Collet (rco) Signed-off-by: Adrian Torres (adt) --- odoo/addons/base/models/ir_module.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odoo/addons/base/models/ir_module.py b/odoo/addons/base/models/ir_module.py index f140a4d8250..632188fadc9 100644 --- a/odoo/addons/base/models/ir_module.py +++ b/odoo/addons/base/models/ir_module.py @@ -613,7 +613,7 @@ class Module(models.Model): def button_uninstall(self): if 'base' in self.mapped('name'): raise UserError(_("The `base` module cannot be uninstalled")) - if not all(state == 'installed' for state in self.mapped('state')): + if not all(state in ('installed', 'to upgrade') for state in self.mapped('state')): raise UserError(_( "One or more of the selected modules have already been uninstalled, if you " "believe this to be an error, you may try again later or contact support."