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 10c733d9..96237924 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()