summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2023-08-31 14:14:43 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2023-08-31 14:14:43 +0700
commiteff76a5d9671ba8a39b58166e3df9428a1f10e0c (patch)
tree3415d04b128c7df531ed3d1b6fb06fab1e664c04
parent215fde914a2eae20928b9e40a9a5dd1ac179c4e1 (diff)
move code to folder solr
-rw-r--r--indoteknik_custom/models/product_pricelist.py10
-rw-r--r--indoteknik_custom/models/solr/product_pricelist_item.py12
2 files changed, 12 insertions, 10 deletions
diff --git a/indoteknik_custom/models/product_pricelist.py b/indoteknik_custom/models/product_pricelist.py
index b0adcef7..026977f8 100644
--- a/indoteknik_custom/models/product_pricelist.py
+++ b/indoteknik_custom/models/product_pricelist.py
@@ -41,12 +41,4 @@ class ProductPricelistItem(models.Model):
manufacture_id = fields.Many2one('x_manufactures', string='Manufacture')
- def action_sync_to_solr(self):
- active_ids = self.env.context.get('active_ids', [])
-
- for pricelist_item_id in active_ids:
- pricelist = self.env['product.pricelist.item'].browse(pricelist_item_id)
-
- templates = self.env['product.template'].search([('id', 'in', [pricelist.product_id.product_tmpl_id.id])])
-
- templates._create_solr_queue('_sync_product_template_to_solr')
+ \ No newline at end of file
diff --git a/indoteknik_custom/models/solr/product_pricelist_item.py b/indoteknik_custom/models/solr/product_pricelist_item.py
index fa042480..3be8c4c0 100644
--- a/indoteknik_custom/models/solr/product_pricelist_item.py
+++ b/indoteknik_custom/models/solr/product_pricelist_item.py
@@ -7,4 +7,14 @@ class ProductPricelistItem(models.Model):
@api.constrains('applied_on', 'product_id', 'base', 'base_pricelist_id', 'price_discount')
def _constrains_related_solr_field(self):
for rec in self:
- rec.product_id.product_tmpl_id._create_solr_queue('_sync_price_to_solr') \ No newline at end of file
+ rec.product_id.product_tmpl_id._create_solr_queue('_sync_price_to_solr')
+
+ def action_sync_to_solr(self):
+ active_ids = self.env.context.get('active_ids', [])
+
+ for pricelist_item_id in active_ids:
+ pricelist = self.env['product.pricelist.item'].browse(pricelist_item_id)
+
+ templates = self.env['product.template'].search([('id', 'in', [pricelist.product_id.product_tmpl_id.id])])
+
+ templates._create_solr_queue('_sync_price_to_solr')