summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2023-06-24 11:22:54 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2023-06-24 11:22:54 +0700
commitd418bd8dd84b91b9dc031819cfa9a2446e77acd2 (patch)
tree1c4071f317ca6ec0a4fb2761cf7663789d5ef5e3
parent6fbfc93c2297bfa4dcf870ec4d57017d602a5f27 (diff)
Fixing percent remaining on program line
-rw-r--r--indoteknik_custom/models/promotion_program_line.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/indoteknik_custom/models/promotion_program_line.py b/indoteknik_custom/models/promotion_program_line.py
index 3ab9b2c0..7aaff4c4 100644
--- a/indoteknik_custom/models/promotion_program_line.py
+++ b/indoteknik_custom/models/promotion_program_line.py
@@ -131,7 +131,9 @@ class PromotionProgramLine(models.Model):
product_price = self.product_id.calculate_website_price()
limit_qty = self._res_limit_qty()
remaining_qty = self._get_remaining_qty(user)
- percent_remaining = (limit_qty['all'] - remaining_qty['all']) / limit_qty['all'] * 100
+ percent_remaining = 0
+ if limit_qty['all'] > 0:
+ percent_remaining = (limit_qty['all'] - remaining_qty['all']) / limit_qty['all'] * 100
return {
'id': self.id,
'name': self.name,