diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2023-08-29 14:21:16 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2023-08-29 14:21:16 +0700 |
| commit | e73ecd7e44d9d3a6c69f6848b8ad197aab71f97d (patch) | |
| tree | c340beda85fce4e942a183d8d632786d487bfbb1 /indoteknik_custom/models | |
| parent | 42bbc269abce7c13618b31702b55c881aa698ab5 (diff) | |
add auto sync solr to product pricelist item
Diffstat (limited to 'indoteknik_custom/models')
| -rw-r--r-- | indoteknik_custom/models/product_pricelist.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/indoteknik_custom/models/product_pricelist.py b/indoteknik_custom/models/product_pricelist.py index 49368948..b0adcef7 100644 --- a/indoteknik_custom/models/product_pricelist.py +++ b/indoteknik_custom/models/product_pricelist.py @@ -40,3 +40,13 @@ class ProductPricelistItem(models.Model): _inherit = 'product.pricelist.item' 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') |
