summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indoteknik_custom/models/solr/product_template.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/indoteknik_custom/models/solr/product_template.py b/indoteknik_custom/models/solr/product_template.py
index 920ae463..fb4974dd 100644
--- a/indoteknik_custom/models/solr/product_template.py
+++ b/indoteknik_custom/models/solr/product_template.py
@@ -50,10 +50,16 @@ class ProductTemplate(models.Model):
def _sync_product_stock_to_solr(self):
self._sync_product_template_to_solr()
+ def get_voucher_pastihemat(self, brandId):
+ voucher_line = self.env['voucher.line'].search([{'voucher_id.code', '=', 'PASTIHEMAT'}, {'manufacure_id', 'in' ,[brandId]}])
+ return voucher_line
+
def _sync_product_template_to_solr(self):
solr_model = self.env['apache.solr']
for template in self:
+
+ voucher = self.get_voucher_pastihemat(template.x_manufacture.id)
variant_names = ', '.join([x.display_name or '' for x in template.product_variant_ids])
variant_codes = ', '.join([x.default_code or '' for x in template.product_variant_ids])
@@ -92,7 +98,12 @@ class ProductTemplate(models.Model):
'publish_b': not template.unpublished,
'sni_b': template.unpublished,
'tkdn_b': template.unpublished,
- "qty_sold_f": template.qty_sold
+ "qty_sold_f": template.qty_sold,
+ "voucher_pastihemat" : {
+ "min_purchase" : voucher.min_purchase_amount,
+ "discount_amount" : voucher.discount_amount,
+ "max_discount" : voucher.max_discount_amount
+ }
})
self.solr().add(docs=[document], softCommit=True)