From 937ea42af35a7db6d5571c72b3444ea9a4489870 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E5=B0=A7?= Date: Tue, 27 Aug 2024 08:54:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=BA=E5=B7=A5=E6=8A=A5?= =?UTF-8?q?=E4=BB=B7=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_production.py | 7 ++++++- sf_manufacturing/models/mrp_workorder.py | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index 8e1f7199..7da6cbbb 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -123,7 +123,12 @@ class MrpProduction(models.Model): # 上传零件图纸 part_drawing = fields.Binary('零件图纸') - manual_quotation = fields.Boolean('人工编程', default=False, readonly=True) + @api.depends('product_id.manual_quotation') + def _compute_manual_quotation(self): + for item in self: + item.manual_quotation = item.product_id.manual_quotation + + manual_quotation = fields.Boolean('人工编程', default=False, compute=_compute_manual_quotation) is_scrap = fields.Boolean('是否报废', default=False) is_remanufacture = fields.Boolean('是否重新制造', default=False) diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index e19887ac..2cfaaccd 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -60,7 +60,12 @@ class ResMrpWorkOrder(models.Model): default='pending', copy=False, readonly=True, recursive=True, index=True, tracking=True) # state = fields.Selection(selection_add=[('to be detected', "待检测"), ('rework', '返工')], tracking=True) - manual_quotation = fields.Boolean('人工编程', default=False, readonly=True) + @api.depends('production_id.manual_quotation') + def _compute_manual_quotation(self): + for item in self: + item.manual_quotation = item.production_id.manual_quotation + + manual_quotation = fields.Boolean('人工编程', default=False, compute=_compute_manual_quotation) def _compute_working_users(self): super()._compute_working_users()