From a2fe5cf62932ee4f112fd2f126ca2ee29036046a Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Mon, 14 Nov 2022 15:04:58 +0700 Subject: change method of update solr flag --- indoteknik_custom/models/x_manufactures.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'indoteknik_custom/models/x_manufactures.py') diff --git a/indoteknik_custom/models/x_manufactures.py b/indoteknik_custom/models/x_manufactures.py index b32d257d..dae37668 100755 --- a/indoteknik_custom/models/x_manufactures.py +++ b/indoteknik_custom/models/x_manufactures.py @@ -1,4 +1,4 @@ -from odoo import models, fields +from odoo import models, fields, api class XManufactures(models.Model): @@ -35,3 +35,13 @@ class XManufactures(models.Model): ('sparepart', 'Spare Part') ], string="Jenis Produk") x_short_desc = fields.Text(string="Short Description") + + @api.onchange('x_name','image_promotion_1','image_promotion_2') + def update_solr_flag(self): + for manufacture in self: + templates = self.env['product.template'].search([ + ('x_manufacture', '=', manufacture.id) + ]) + for template in templates: + if template.solr_flag == 1: + template.solr_flag = 2 -- cgit v1.2.3