diff options
| -rwxr-xr-x | indoteknik_custom/models/product_template.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index 28356a86..13654ab3 100755 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -33,13 +33,17 @@ class ProductTemplate(models.Model): web_price_sorting = fields.Float('Web Price Sorting', help='Hanya digunakan untuk sorting di web, harga tidak berlaku', default=0.0) virtual_qty = fields.Float(string='Virtual Qty', default=0) solr_flag = fields.Integer(string='Solr Flag', default=0) + + def write(self, vals): + vals['solr_flag'] = 2 + return super().write(vals) def _compute_qty_stock_vendor(self): for product_template in self: product_template.qty_stock_vendor = 0 for product_variant in product_template.product_variant_ids: product_template.qty_stock_vendor += int(product_variant.qty_stock_vendor) - + def _compute_web_price(self): for template in self: product = self.env['product.product'].search([('product_tmpl_id', '=', template.id)], limit=1) @@ -144,6 +148,11 @@ class ProductProduct(models.Model): 'Qty Stock Vendor', compute='_compute_stock_vendor', help="Stock Vendor") solr_flag = fields.Integer(string='Solr Flag', default=0) + + def write(self, vals): + self.product_tmpl_id.solr_flag = 2 + vals['solr_flag'] = 2 + return super().write(vals) def _compute_web_price(self): for product in self: |
