[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>
This commit is contained in:
committed by
Adrian Torres
parent
feb830e9f7
commit
64ae832a8a
@@ -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."
|
||||
|
||||
Reference in New Issue
Block a user