From 1a27ae4f9ec137d7af69175afb67a094873738b9 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Fri, 24 Nov 2023 16:51:02 +0700 Subject: add new condition on publish_b solr --- indoteknik_custom/models/solr/product_template.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indoteknik_custom/models/solr/product_template.py') diff --git a/indoteknik_custom/models/solr/product_template.py b/indoteknik_custom/models/solr/product_template.py index 648a0625..123a95ac 100644 --- a/indoteknik_custom/models/solr/product_template.py +++ b/indoteknik_custom/models/solr/product_template.py @@ -82,7 +82,7 @@ class ProductTemplate(models.Model): "category_name": category_name, "description_t": template.website_description or '', 'has_product_info_b': True, - 'publish_b': not template.unpublished, + 'publish_b': not template.unpublished or not template.active, "qty_sold_f": template.qty_sold }) -- cgit v1.2.3 From 1941896aebea3908b1763a4bd4244e5ac7e78bc6 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Fri, 24 Nov 2023 17:07:53 +0700 Subject: add constrains active on template and variant --- indoteknik_custom/models/solr/product_template.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'indoteknik_custom/models/solr/product_template.py') diff --git a/indoteknik_custom/models/solr/product_template.py b/indoteknik_custom/models/solr/product_template.py index 123a95ac..fd3357fd 100644 --- a/indoteknik_custom/models/solr/product_template.py +++ b/indoteknik_custom/models/solr/product_template.py @@ -28,6 +28,12 @@ class ProductTemplate(models.Model): def _create_solr_queue_sync_product_template(self): self._create_solr_queue('_sync_product_template_to_solr') + @api.constrains('active') + def _constrains_active(self): + for rec in self: + if not rec.active: + rec.unpublished = True + def action_sync_to_solr(self): template_ids = self.env.context.get('active_ids', []) templates = self.search([('id', 'in', template_ids)]) @@ -82,7 +88,7 @@ class ProductTemplate(models.Model): "category_name": category_name, "description_t": template.website_description or '', 'has_product_info_b': True, - 'publish_b': not template.unpublished or not template.active, + 'publish_b': not template.unpublished, "qty_sold_f": template.qty_sold }) -- cgit v1.2.3 From e9dec832ab749b1c72dc358603d00ad7a35d4bb6 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Sat, 25 Nov 2023 09:21:30 +0700 Subject: Update domain filter solr_flag in product template to solr_queue --- indoteknik_custom/models/solr/product_template.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indoteknik_custom/models/solr/product_template.py') diff --git a/indoteknik_custom/models/solr/product_template.py b/indoteknik_custom/models/solr/product_template.py index 648a0625..c09a6e5a 100644 --- a/indoteknik_custom/models/solr/product_template.py +++ b/indoteknik_custom/models/solr/product_template.py @@ -34,7 +34,7 @@ class ProductTemplate(models.Model): templates._create_solr_queue('_sync_product_template_to_solr') def solr_flag_to_solr(self, limit=500): - template_products = self.search([('solr_flag', '=', 2)], limit=limit) + template_products = self.search([('solr_flag', '=', 2), ('active', 'in', [True, False])], limit=limit) for product in template_products: product._create_solr_queue('_sync_product_template_to_solr') product._create_solr_queue('_sync_price_to_solr') -- cgit v1.2.3