From d9f73a9ce6d37cc9b7c2658f1da2e7db805d370a Mon Sep 17 00:00:00 2001 From: Nicolas Pierre Date: Fri, 10 Sep 2021 15:13:51 +0000 Subject: [PATCH] [FIX] mrp: archive QC linked to archived operation Instead of the delete icon next to the operations in a BoM, create a button to archive the operation. Archiving an operation will also archive the corresponding Quality Check. closes odoo/odoo#77456 Task-id: 2619450 Community-pr: https://github.com/odoo/odoo/pull/76376 Enterprise-pr: https://github.com/odoo/enterprise/pull/20785 X-original-commit: 9761ef89ca0f12f2907d844451e56c4a833ee8ef Related: odoo/enterprise#21291 Signed-off-by: William Henrotin --- addons/mrp/models/mrp_bom.py | 4 ++++ addons/mrp/views/mrp_production_views.xml | 2 +- addons/mrp/views/mrp_routing_views.xml | 7 +++++++ addons/mrp/views/mrp_workorder_views.xml | 3 +-- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/addons/mrp/models/mrp_bom.py b/addons/mrp/models/mrp_bom.py index 8bc20424e77..4ff2cdb9c4e 100644 --- a/addons/mrp/models/mrp_bom.py +++ b/addons/mrp/models/mrp_bom.py @@ -176,6 +176,10 @@ class MrpBom(models.Model): raise UserError(_("You cannot create a new Bill of Material from here.")) return super(MrpBom, self).name_create(name) + def toggle_active(self): + self.with_context({'active_test': False}).operation_ids.toggle_active() + return super().toggle_active() + def name_get(self): return [(bom.id, '%s%s' % (bom.code and '%s: ' % bom.code or '', bom.product_tmpl_id.display_name)) for bom in self] diff --git a/addons/mrp/views/mrp_production_views.xml b/addons/mrp/views/mrp_production_views.xml index d329b04a429..9248c417955 100644 --- a/addons/mrp/views/mrp_production_views.xml +++ b/addons/mrp/views/mrp_production_views.xml @@ -181,7 +181,7 @@