summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro M. Baeza <pedro.baeza@tecnativa.com>2020-04-28 08:53:48 +0000
committerAdrian Torres <adt@odoo.com>2020-04-28 13:12:27 +0000
commit64ae832a8ae04ad86b7707e507b71ab612bce87e (patch)
tree44cf93b8571f2470137ea6465f12f530d52d3c24
parentfeb830e9f7530084eba4301c04a8e14eea92b143 (diff)
[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) <rco@openerp.com> Signed-off-by: Adrian Torres (adt) <adt@odoo.com>
-rw-r--r--odoo/addons/base/models/ir_module.py2
1 files changed, 1 insertions, 1 deletions
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."