diff --git a/sf_manufacturing/models/sf_production_common.py b/sf_manufacturing/models/sf_production_common.py index 708199bb..6285c133 100644 --- a/sf_manufacturing/models/sf_production_common.py +++ b/sf_manufacturing/models/sf_production_common.py @@ -21,6 +21,12 @@ class SfProductionProcessParameter(models.Model): for record in self: if len(record.outsourced_service_products) > 1: raise ValidationError("工艺参数不能与多个产品关联") + + @api.onchange('outsourced_service_products') + def _onchange_validate_partner_limit(self): + for record in self: + if len(record.outsourced_service_products) > 1: + raise ValidationError("工艺参数不能与多个产品关联") @api.depends('outsourced_service_products') def _compute_is_product_button(self): for record in self: diff --git a/sf_manufacturing/views/mrp_routing_workcenter_view.xml b/sf_manufacturing/views/mrp_routing_workcenter_view.xml index d1eb0618..3c3bb27a 100644 --- a/sf_manufacturing/views/mrp_routing_workcenter_view.xml +++ b/sf_manufacturing/views/mrp_routing_workcenter_view.xml @@ -30,7 +30,7 @@ - +