summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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,