summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIT Fixcomart <it@fixcomart.co.id>2024-07-05 08:41:27 +0000
committerIT Fixcomart <it@fixcomart.co.id>2024-07-05 08:41:27 +0000
commitbe39266e634e750c553fe004a067dd1b8024dfc4 (patch)
tree82da5a80a8a0ade6c95a17c20f4071d40d7a259b
parent074f7e6c0190c1ae5e08db6db0dd3f4f3e28e941 (diff)
parentd00eb6cdf40c7110a4a53422fcd20c0d46df25ee (diff)
Merged in feature/iman_sequence (pull request #154)
<iman> add total qty sold product for sorting promotion program
-rw-r--r--indoteknik_custom/models/solr/promotion_program_line.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/indoteknik_custom/models/solr/promotion_program_line.py b/indoteknik_custom/models/solr/promotion_program_line.py
index 8f62ecc0..73504c48 100644
--- a/indoteknik_custom/models/solr/promotion_program_line.py
+++ b/indoteknik_custom/models/solr/promotion_program_line.py
@@ -26,7 +26,8 @@ class PromotionProgramLine(models.Model):
products = [{
'product_id': x.product_id.id,
- 'qty': x.qty
+ 'qty': x.qty,
+ 'qty_sold': x.product_id.qty_sold
} for x in rec.product_ids]
free_products = [{
@@ -52,8 +53,10 @@ 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]),
+ 'total_qty_sold_f': [x.product_id.qty_sold for x in rec.product_ids],
'active_b': rec.active
})
+
self.solr().add([document])
self.solr().commit()