summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indoteknik_custom/models/voucher.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/indoteknik_custom/models/voucher.py b/indoteknik_custom/models/voucher.py
index 588e9ac5..66f763e0 100644
--- a/indoteknik_custom/models/voucher.py
+++ b/indoteknik_custom/models/voucher.py
@@ -153,7 +153,7 @@ class Voucher(models.Model):
discount_all = total['all'] * decimal_discount
result['all'] = min(discount_all, self.max_discount_amount) if self.max_discount_amount > 0 else discount_all
else:
- result['all'] = self.discount_amount
+ result['all'] = min(self.discount_amount, total['all'])
return result
@@ -169,7 +169,7 @@ class Voucher(models.Model):
discount_brand = total_brand * decimal_discount
discount_brand = min(discount_brand, line.max_discount_amount) if line.max_discount_amount > 0 else discount_brand
else:
- discount_brand = line.discount_amount
+ discount_brand = min(line.discount_amount, total_brand)
result['brand'][manufacture_id] = round(discount_brand, 2)
result['all'] += discount_brand