summaryrefslogtreecommitdiff
path: root/indoteknik_custom
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2023-12-22 11:20:45 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2023-12-22 11:20:45 +0700
commitad127a4dc2bfb81d9c99ba78ab41a49eefeb0dd2 (patch)
tree218343dfe94a59e0651f880e9c291225c179f9a2 /indoteknik_custom
parentde6039ab7675d91bcfcb67747d3c72be95a379e6 (diff)
update promotion program feature
Diffstat (limited to 'indoteknik_custom')
-rw-r--r--indoteknik_custom/models/promotion/promotion_program_line.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/indoteknik_custom/models/promotion/promotion_program_line.py b/indoteknik_custom/models/promotion/promotion_program_line.py
index 34a0fbb2..d9095c75 100644
--- a/indoteknik_custom/models/promotion/promotion_program_line.py
+++ b/indoteknik_custom/models/promotion/promotion_program_line.py
@@ -96,7 +96,11 @@ class PromotionProgramLine(models.Model):
weight = 0
if not any(x['package_weight'] == 0 for x in merged_products):
weight = sum(x['package_weight'] for x in merged_products)
-
+
+ products_total = sum(x['price']['price_discount'] * x['qty'] for x in products)
+ free_products_total = sum(x['price']['price_discount'] * x['qty'] for x in free_products)
+ package_price = products_total + free_products_total
+
response = {
'id': self.id,
'name': self.name,
@@ -106,6 +110,7 @@ class PromotionProgramLine(models.Model):
'limit_qty': limit_qty,
'remaining_qty': remaining_qty,
'used_percentage': percent_remaining,
+ 'package_price': package_price,
'price': {
'price': self.price,
'price_discount': self.price,