Skip to content

Commit

Permalink
[FIX] sale_commission_product_criteria_discount: reset distount when …
Browse files Browse the repository at this point in the history
…based_on is changed
  • Loading branch information
ilyasProgrammer committed Jun 22, 2023
1 parent 1aa4615 commit 6590514
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ class CommissionItem(models.Model):
discount_from = fields.Float("Discount From")
discount_to = fields.Float("Discount To")

@api.onchange("based_on")
def onchange_based_on(self):
if self.based_on != "discount":
self.update({"discount_from": 0, "discount_to": 0})

@api.constrains("discount_from", "discount_to")
def _check_discounts(self):
if any(item.discount_from > item.discount_to for item in self):
Expand Down

0 comments on commit 6590514

Please sign in to comment.