diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-04-04 09:56:43 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-04-04 09:56:43 +0700 |
| commit | 2a0a2ba14501a6becdc7655d8924bfdc1123877e (patch) | |
| tree | ba59d6dcf30abd7efc9bbd55e300ef0e50cfb70f | |
| parent | 3a15f04a073aa196305f4904dd3ef044a908aaf8 (diff) | |
fix apache solr
| -rw-r--r-- | indoteknik_custom/models/apache_solr.py | 8 |
1 files 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 |
