summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIT Fixcomart <it@fixcomart.co.id>2022-11-01 17:06:30 +0700
committerIT Fixcomart <it@fixcomart.co.id>2022-11-01 17:06:30 +0700
commit6fdaee1c7b6557dc2e61ac7b5c1172d285ea7421 (patch)
treedba76409fa4825ab11c7fec8d37b6490e9de6e6c
parent25ab8a7f448c5a7045b6944839622a3f79900164 (diff)
Update solr_flag (product on update)
-rwxr-xr-xindoteknik_custom/models/product_template.py11
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: