We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 81a9385 + 90aca03 commit b415b0eCopy full SHA for b415b0e
product_contract/models/product_template.py
@@ -73,7 +73,13 @@ def write(self, vals):
73
@api.constrains("is_contract", "type")
74
def _check_contract_product_type(self):
75
"""
76
- Contract product should be service type
+ Contract product should be service type, check by recordset
77
78
- if self.is_contract and self.type != "service":
79
- raise ValidationError(_("Contract product should be service type"))
+ for record in self:
+ if record.is_contract and record.type != "service":
80
+ raise ValidationError(
81
+ _(
82
+ "Contract product (%(product_name)s) should be service type",
83
+ product_name=record.name,
84
+ )
85
0 commit comments