summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2023-07-25 11:22:19 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2023-07-25 11:22:19 +0700
commite24789e8df500f47e6d1df28e3c656874709eb70 (patch)
treea7e39d9278521544f2df822d9b22e584f642ed40
parenta22d0a2443c89d6129ab1d5c2e8324985244007d (diff)
Bug fix calculate discount function on voucher
-rw-r--r--indoteknik_custom/models/voucher.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/indoteknik_custom/models/voucher.py b/indoteknik_custom/models/voucher.py
index b3a55499..a7151398 100644
--- a/indoteknik_custom/models/voucher.py
+++ b/indoteknik_custom/models/voucher.py
@@ -107,7 +107,7 @@ class Voucher(models.Model):
if self.discount_type == 'percentage':
discount = price * self.discount_amount / 100
max_disc = self.max_discount_amount
- return max_disc if discount > max_disc else discount
+ return discount if max_disc == 0 else min(discount, max_disc)
return 0