diff options
Diffstat (limited to 'indoteknik_custom/models/product_template.py')
| -rwxr-xr-x | indoteknik_custom/models/product_template.py | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index 4c8f664d..5d34fbc8 100755 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -34,10 +34,16 @@ class ProductTemplate(models.Model): virtual_qty = fields.Float(string='Virtual Qty', default=0) solr_flag = fields.Integer(string='Solr Flag', default=0) - def write(self, vals): - if 'solr_flag' not in vals and self.solr_flag == 1: - vals['solr_flag'] = 2 - return super().write(vals) + # def write(self, vals): + # if 'solr_flag' not in vals and self.solr_flag == 1: + # vals['solr_flag'] = 2 + # return super().write(vals) + + @api.onchange('name','default_code','x_manufacture','product_rating','website_description','image_1920','weight','public_categ_ids') + def update_solr_flag(self): + for tmpl in self: + if tmpl.solr_flag == 1: + tmpl.solr_flag = 2 def _compute_qty_stock_vendor(self): for product_template in self: @@ -150,13 +156,13 @@ class ProductProduct(models.Model): help="Stock Vendor") solr_flag = fields.Integer(string='Solr Flag', default=0) - def write(self, vals): - if 'solr_flag' not in vals: - for variant in self: - if variant.solr_flag == 1: - variant.product_tmpl_id.solr_flag = 2 - vals['solr_flag'] = 2 - return super().write(vals) + # def write(self, vals): + # if 'solr_flag' not in vals: + # for variant in self: + # if variant.solr_flag == 1: + # variant.product_tmpl_id.solr_flag = 2 + # vals['solr_flag'] = 2 + # return super().write(vals) def _compute_web_price(self): for product in self: |
