diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-11-14 15:50:34 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-11-14 15:50:34 +0700 |
| commit | 20b2bd76be6052a1a3b2e3b61c027fe91f5046a9 (patch) | |
| tree | 6089b4c7b127724516bfdf7ce7c36a45f73e54d2 /indoteknik_custom/models/product_template.py | |
| parent | 84be6c76c2a2d6023f4151f3863cb11806bb7fa6 (diff) | |
| parent | a2fe5cf62932ee4f112fd2f126ca2ee29036046a (diff) | |
Merge branch 'master'
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: |
