Skip to content

Commit

Permalink
[14.0][FIX] product_contract recordset in constrains
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiocorato committed Jun 30, 2024
1 parent 1b67695 commit 90aca03
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions product_contract/models/product_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,13 @@ def write(self, vals):
@api.constrains("is_contract", "type")
def _check_contract_product_type(self):
"""
Contract product should be service type
Contract product should be service type, check by recordset
"""
if self.is_contract and self.type != "service":
raise ValidationError(_("Contract product should be service type"))
for record in self:
if record.is_contract and record.type != "service":
raise ValidationError(
_(
"Contract product (%(product_name)s) should be service type",
product_name=record.name,
)
)

0 comments on commit 90aca03

Please sign in to comment.