diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2024-02-21 10:21:01 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2024-02-21 10:21:01 +0700 |
| commit | 99df2a863b6d641e96b7dd9fafbed701642d5ca7 (patch) | |
| tree | 6e3970b6e4aaf074b564ef7cc316188ee3910a6a | |
| parent | c0daeae791b069aa77baad4b19ecd400c75a42d6 (diff) | |
Fix promotion program line weight
| -rw-r--r-- | indoteknik_custom/models/promotion/promotion_program_line.py | 4 | ||||
| -rw-r--r-- | indoteknik_custom/models/solr/promotion_program_line.py | 1 |
2 files changed, 2 insertions, 3 deletions
diff --git a/indoteknik_custom/models/promotion/promotion_program_line.py b/indoteknik_custom/models/promotion/promotion_program_line.py index 9fab6e58..ce46d2e7 100644 --- a/indoteknik_custom/models/promotion/promotion_program_line.py +++ b/indoteknik_custom/models/promotion/promotion_program_line.py @@ -97,9 +97,7 @@ class PromotionProgramLine(models.Model): free_products = self.free_product_ids.formats(purchase_qty=qty) merged_products = products + free_products - weight = 0 - if not any(x['package_weight'] == 0 for x in merged_products): - weight = sum(x['package_weight'] for x in merged_products) + weight = sum(x['package_weight'] for x in merged_products) # Sum of products and free products in 1 package quantity products_total = sum(x['price']['price_discount'] * x['qty'] / qty for x in products) diff --git a/indoteknik_custom/models/solr/promotion_program_line.py b/indoteknik_custom/models/solr/promotion_program_line.py index edee259f..30ce16c9 100644 --- a/indoteknik_custom/models/solr/promotion_program_line.py +++ b/indoteknik_custom/models/solr/promotion_program_line.py @@ -52,6 +52,7 @@ class PromotionProgramLine(models.Model): 'free_product_ids': [x.product_id.id for x in rec.free_product_ids], 'free_products_s': json.dumps(free_products), 'total_qty_i': sum([x.qty for x in rec.product_ids] + [x.qty for x in rec.free_product_ids]), + 'active': rec.active }) self.solr().add([document]) |
