summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/voucher.py
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2024-04-29 09:24:25 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2024-04-29 09:24:25 +0700
commit074b99031f5123976bb67aab1cf1a6286464e724 (patch)
tree2809d42a13b35c42ec00d93a40a414e7713a1bc2 /indoteknik_custom/models/voucher.py
parentb5a42eda62ae2b3536a072b9cb21a61e91a7b49a (diff)
parentca03f0119e33dd62adbf998106378d8e0f4096b6 (diff)
Merge branch 'production' into feature/request-by-abl
Diffstat (limited to 'indoteknik_custom/models/voucher.py')
-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