diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-11-14 15:04:58 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-11-14 15:04:58 +0700 |
| commit | a2fe5cf62932ee4f112fd2f126ca2ee29036046a (patch) | |
| tree | e2813d1766dcfbdce3931767947b507cd7a3e67b /indoteknik_custom/models/x_manufactures.py | |
| parent | c6ace1b75f1c93e1706cfa6f82b7f34513b209f5 (diff) | |
change method of update solr flag
Diffstat (limited to 'indoteknik_custom/models/x_manufactures.py')
| -rwxr-xr-x | indoteknik_custom/models/x_manufactures.py | 12 |
1 files changed, 11 insertions, 1 deletions
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 |
