From 2a0a2ba14501a6becdc7655d8924bfdc1123877e Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Tue, 4 Apr 2023 09:56:43 +0700 Subject: fix apache solr --- indoteknik_custom/models/apache_solr.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/indoteknik_custom/models/apache_solr.py b/indoteknik_custom/models/apache_solr.py index b19f585f..bafd94e5 100644 --- a/indoteknik_custom/models/apache_solr.py +++ b/indoteknik_custom/models/apache_solr.py @@ -11,12 +11,12 @@ class ApacheSolr(models.Model): _name = 'apache.solr' _order = 'id desc' - def _sync_product_to_solr(self): + def _sync_product_to_solr(self, limit = 500): _logger.info('run sync to solr...') solr = pysolr.Solr('http://10.148.0.5:8983/solr/product/', always_commit=True, timeout=30) query = ["&","&",("type","=","product"),("active","=",True),"|",("solr_flag","=",0),("solr_flag","=",2)] - templates = self.env['product.template'].search(query, limit=500) + templates = self.env['product.template'].search(query, limit=limit) document = [] counter = 0 for template in templates: @@ -47,7 +47,9 @@ class ApacheSolr(models.Model): discount = template.product_variant_id._get_website_disc(0) price_excl_after_disc = template.product_variant_id._get_website_price_after_disc_and_tax() tax = template.product_variant_id._get_website_tax() - + + category_id = '' + category_name = '' for category in template.public_categ_ids: category_id = category.id category_name = category.name -- cgit v1.2.3