[FIX] mrp: keep operations at uninstallation

The commit 1355c9694e
archive all mrp operations at "Work Order" setting unticking. The good
way would be to hide the operations if the setting is deactivate.

closes odoo/odoo#72985

X-original-commit: 58d42aea296ac9ff548542a3120c6e81bbd61d02
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
This commit is contained in:
William Henrotin
2021-06-30 10:25:21 +00:00
parent cf7a21d733
commit f4567e4b6b
+1 -4
View File
@@ -34,10 +34,7 @@ class ResConfigSettings(models.TransientModel):
# Work Orders' is deactivated.
# Long story short: if 'mrp_workorder' is already installed, we don't uninstall it based on
# group_mrp_routings
operations = self.env['mrp.routing.workcenter'].with_context({'active_test': False}).search([('company_id', '=', self.company_id.id)])
if self.group_mrp_routings:
self.module_mrp_workorder = True
else:
operations.action_archive() # When deactivating workorders we want to archive all the operations linked to the company
if not self.env['ir.module.module'].search([('name', '=', 'mrp_workorder'), ('state', '=', 'installed')]):
self.module_mrp_workorder = False
self.module_mrp_workorder = False