From e24789e8df500f47e6d1df28e3c656874709eb70 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Tue, 25 Jul 2023 11:22:19 +0700 Subject: Bug fix calculate discount function on voucher --- indoteknik_custom/models/voucher.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- cgit v1.2.3