Skip to content
Browse files

[FIX] mrp: mrp_workorder uninstall

- Install 'quality_mrp_workorder' without demo data
- Uninstall it
- Install it again
- Go to the General Settings

A warning is raised regarding the uninstallation of 'mrp_workorder'.

This is due to `_onchange_group_mrp_routings`, which assumes that the
installation of 'mrp_workorder' is only linked to the group

This is incorrect: `group_mrp_routings` might not be activated, but it
might be in the dependencies of another module. Therefore, we change the
logic: if we activate `group_mrp_routings`, we install 'mrp_workorder'.
If we deactivate `group_mrp_routings` we do not uninstall
'mrp_workorder' if it is already installed, since it might be required
by a dependancy.

  • Loading branch information...
nim-odoo committed Apr 18, 2019
1 parent 6dcf798 commit 9728d1b33d8d550340274272291f680ccf594ce1
Showing with 10 additions and 1 deletion.
  1. +10 −1 addons/mrp/models/
@@ -24,4 +24,13 @@ def _onchange_use_manufacturing_lead(self):

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

0 comments on commit 9728d1b

Please sign in to comment.
You can’t perform that action at this time.