diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2023-08-31 14:14:43 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2023-08-31 14:14:43 +0700 |
| commit | eff76a5d9671ba8a39b58166e3df9428a1f10e0c (patch) | |
| tree | 3415d04b128c7df531ed3d1b6fb06fab1e664c04 /indoteknik_custom/models/solr | |
| parent | 215fde914a2eae20928b9e40a9a5dd1ac179c4e1 (diff) | |
move code to folder solr
Diffstat (limited to 'indoteknik_custom/models/solr')
| -rw-r--r-- | indoteknik_custom/models/solr/product_pricelist_item.py | 12 |
1 files changed, 11 insertions, 1 deletions
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') |
