diff --git a/addons/mrp/models/res_config_settings.py b/addons/mrp/models/res_config_settings.py index 5e47515b1f3..dcda06cb4c2 100644 --- a/addons/mrp/models/res_config_settings.py +++ b/addons/mrp/models/res_config_settings.py @@ -24,4 +24,13 @@ class ResConfigSettings(models.TransientModel): @api.onchange('group_mrp_routings') def _onchange_group_mrp_routings(self): - self.module_mrp_workorder = self.group_mrp_routings + # If we activate 'MRP Work Orders', it means that we need to install 'mrp_workorder'. + # The opposite is not always true: other modules (such as 'quality_mrp_workorder') may + # depend on 'mrp_workorder', so we should not automatically uninstall the module if 'MRP + # Work Orders' is deactivated. + # Long story short: if 'mrp_workorder' is already installed, we don't uninstall it based on + # group_mrp_routings + if self.group_mrp_routings: + self.module_mrp_workorder = True + elif not self.env['ir.module.module'].search([('name', '=', 'mrp_workorder'), ('state', '=', 'installed')]): + self.module_mrp_workorder = False