summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/solr
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2023-09-12 15:43:52 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2023-09-12 15:43:52 +0700
commit890be59e4dadafc6e25651fcb9de20e2b24379cc (patch)
treea699e771693a3f89633f01d1870aee11d0cb76c1 /indoteknik_custom/models/solr
parent888a3ca6337a1622f4f16b98b700cdd437ab6023 (diff)
Sync to solr product variant solr flag 2, Sync to solr product template solr flag 2
Diffstat (limited to 'indoteknik_custom/models/solr')
-rw-r--r--indoteknik_custom/models/solr/product_product.py9
-rw-r--r--indoteknik_custom/models/solr/product_template.py7
2 files changed, 15 insertions, 1 deletions
diff --git a/indoteknik_custom/models/solr/product_product.py b/indoteknik_custom/models/solr/product_product.py
index a3bd3d04..23ab51fd 100644
--- a/indoteknik_custom/models/solr/product_product.py
+++ b/indoteknik_custom/models/solr/product_product.py
@@ -20,6 +20,13 @@ class ProductProduct(models.Model):
products = self.search([('id', 'in', product_ids)])
for product in products:
product.product_tmpl_id._create_solr_queue('_sync_product_template_to_solr')
+
+ def variant_solr_flag_to_solr(self, limit=500):
+ variant_products = self.search([('solr_flag', '=', 2)], limit=limit)
+ if variant_products:
+ for product in variant_products:
+ product._create_solr_queue('_sync_price_to_solr')
+ product.solr_flag = 1
def _sync_variants_to_solr(self):
solr_model = self.env['apache.solr']
@@ -62,7 +69,7 @@ class ProductProduct(models.Model):
variant.change_solr_data('Perubahan pada data product')
self.solr().commit()
-
+
def _sync_price_to_solr(self):
solr_model = self.env['apache.solr']
diff --git a/indoteknik_custom/models/solr/product_template.py b/indoteknik_custom/models/solr/product_template.py
index b93d0a4f..9d714713 100644
--- a/indoteknik_custom/models/solr/product_template.py
+++ b/indoteknik_custom/models/solr/product_template.py
@@ -35,6 +35,13 @@ class ProductTemplate(models.Model):
template_ids = self.env.context.get('active_ids', [])
templates = self.search([('id', 'in', template_ids)])
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)
+ if template_products:
+ for product in template_products:
+ product._create_solr_queue('_sync_price_to_solr')
+ product.solr_flag = 1
def _sync_active_template_solr(self):
for template in self: