diff options
| -rw-r--r-- | indoteknik_custom/models/product_pricelist.py | 10 | ||||
| -rw-r--r-- | indoteknik_custom/views/product_pricelist.xml | 8 | ||||
| -rwxr-xr-x | indoteknik_custom/views/product_pricelist_item.xml | 7 |
3 files changed, 17 insertions, 8 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') diff --git a/indoteknik_custom/views/product_pricelist.xml b/indoteknik_custom/views/product_pricelist.xml index 34876cc4..55139a24 100644 --- a/indoteknik_custom/views/product_pricelist.xml +++ b/indoteknik_custom/views/product_pricelist.xml @@ -25,12 +25,4 @@ </page> </field> </record> - - <record id="product_pricelist_sync_product_solr_ir_actions_server" model="ir.actions.server"> - <field name="name">Sync Product to SOLR</field> - <field name="model_id" ref="product.model_product_pricelist"/> - <field name="binding_model_id" ref="product.model_product_pricelist"/> - <field name="state">code</field> - <field name="code">action = records.update_product_solr_flag()</field> - </record> </odoo>
\ No newline at end of file diff --git a/indoteknik_custom/views/product_pricelist_item.xml b/indoteknik_custom/views/product_pricelist_item.xml index 2b70f1e1..973ae181 100755 --- a/indoteknik_custom/views/product_pricelist_item.xml +++ b/indoteknik_custom/views/product_pricelist_item.xml @@ -45,5 +45,12 @@ </field> </record> + <record id="product_pricelist_item_sync_product_solr_ir_actions_server" model="ir.actions.server"> + <field name="name">Sync Product to SOLR</field> + <field name="model_id" ref="product.model_product_pricelist_item"/> + <field name="binding_model_id" ref="product.model_product_pricelist_item"/> + <field name="state">code</field> + <field name="code">model.action_sync_to_solr()</field> + </record> </data> </odoo>
\ No newline at end of file |
