diff options
| -rw-r--r-- | indoteknik_custom/models/product_pricelist.py | 10 | ||||
| -rw-r--r-- | indoteknik_custom/models/solr/product_pricelist_item.py | 12 |
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') |
