summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/solr
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2023-11-03 13:46:16 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2023-11-03 13:46:16 +0700
commite94cfd1fee485d0e84fb50a66a7584572452b5dc (patch)
tree7f0e82becba364b8b984ef27df660635d1e1f9f6 /indoteknik_custom/models/solr
parent566a20db595a2b0a1959a12d289361b16e1ef172 (diff)
parent6b49797aca36574497f93a06f8e1c0622e5ad009 (diff)
Merge branch 'production' of bitbucket.org:altafixco/indoteknik-addons into production
# Conflicts: # indoteknik_custom/__manifest__.py # indoteknik_custom/models/__init__.py
Diffstat (limited to 'indoteknik_custom/models/solr')
-rw-r--r--indoteknik_custom/models/solr/product_product.py1
-rw-r--r--indoteknik_custom/models/solr/product_template.py3
-rw-r--r--indoteknik_custom/models/solr/x_manufactures.py2
3 files changed, 4 insertions, 2 deletions
diff --git a/indoteknik_custom/models/solr/product_product.py b/indoteknik_custom/models/solr/product_product.py
index 85c94741..03eaaf13 100644
--- a/indoteknik_custom/models/solr/product_product.py
+++ b/indoteknik_custom/models/solr/product_product.py
@@ -25,6 +25,7 @@ class ProductProduct(models.Model):
def variant_solr_flag_to_solr(self, limit=500):
variant_products = self.search([('solr_flag', '=', 2)], limit=limit)
for product in variant_products:
+ product.product_tmpl_id._create_solr_queue('_sync_product_template_to_solr')
product.product_tmpl_id._create_solr_queue('_sync_price_to_solr')
product.solr_flag = 1
diff --git a/indoteknik_custom/models/solr/product_template.py b/indoteknik_custom/models/solr/product_template.py
index 25d7d4b8..648a0625 100644
--- a/indoteknik_custom/models/solr/product_template.py
+++ b/indoteknik_custom/models/solr/product_template.py
@@ -36,6 +36,7 @@ class ProductTemplate(models.Model):
def solr_flag_to_solr(self, limit=500):
template_products = self.search([('solr_flag', '=', 2)], limit=limit)
for product in template_products:
+ product._create_solr_queue('_sync_product_template_to_solr')
product._create_solr_queue('_sync_price_to_solr')
product.solr_flag = 1
@@ -136,7 +137,7 @@ class ProductTemplate(models.Model):
price_tier = price_doc.get(f"{price_tier_key}_f", 0)
# When price tier is 0 or variant_price less than price tier then use variant price
- if price_tier == 0 or variant_price < price_tier:
+ if price_tier == 0 or (variant_price < price_tier and variant_price > 0):
price_doc[f"{discount_tier_key}_f"] = variant_discount
price_doc[f"{price_tier_key}_f"] = variant_price
diff --git a/indoteknik_custom/models/solr/x_manufactures.py b/indoteknik_custom/models/solr/x_manufactures.py
index 375b7708..98b1d01d 100644
--- a/indoteknik_custom/models/solr/x_manufactures.py
+++ b/indoteknik_custom/models/solr/x_manufactures.py
@@ -40,7 +40,7 @@ class XManufactures(models.Model):
document.update({
'id': brands.id,
'display_name_s': brands.display_name,
- 'name_s': brands.x_name,
+ 'name_s': brands.x_name.lower(),
'sequence_i': brands.sequence or '',
'negara_asal_s': brands.x_negara_asal or '',
'short_desc_s': brands.x_short_desc or '',