From 5ddda2a380e9aeaf63241e8f6b1c35e3005a3468 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Mon, 23 Oct 2023 15:36:50 +0700 Subject: Add action on sync by solr flag --- indoteknik_custom/models/solr/product_product.py | 1 + indoteknik_custom/models/solr/product_template.py | 1 + 2 files changed, 2 insertions(+) (limited to 'indoteknik_custom/models/solr') 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..2bbcab9c 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 -- cgit v1.2.3 From 5bb681f2975a3fb38fcd87c89f72d18c6e794170 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Sat, 28 Oct 2023 10:07:00 +0700 Subject: Bug fix condition sync product price to solr --- indoteknik_custom/models/solr/product_template.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indoteknik_custom/models/solr') diff --git a/indoteknik_custom/models/solr/product_template.py b/indoteknik_custom/models/solr/product_template.py index 2bbcab9c..648a0625 100644 --- a/indoteknik_custom/models/solr/product_template.py +++ b/indoteknik_custom/models/solr/product_template.py @@ -137,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 -- cgit v1.2.3 From c114fc17c7502174415c4e4bf1e7f8e24a46998c Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Mon, 30 Oct 2023 08:59:11 +0700 Subject: Change name manufacture on solr to lowercase --- indoteknik_custom/models/solr/x_manufactures.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indoteknik_custom/models/solr') 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 '', -- cgit v1.2.3