summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-11-02 11:21:54 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-11-02 11:21:54 +0700
commit4396d6b781775f4b0be4b076e65d9ec8b29a01aa (patch)
treede11809db732aeeb49d17dfdcad4540792eca127
parente68240fe7de4b327785f80ad629b34550c3d8554 (diff)
Update product_template.py
-rwxr-xr-xindoteknik_custom/models/product_template.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py
index 13654ab3..6bd1acda 100755
--- a/indoteknik_custom/models/product_template.py
+++ b/indoteknik_custom/models/product_template.py
@@ -35,7 +35,8 @@ class ProductTemplate(models.Model):
solr_flag = fields.Integer(string='Solr Flag', default=0)
def write(self, vals):
- vals['solr_flag'] = 2
+ if not vals['solr_flag']:
+ vals['solr_flag'] = 2
return super().write(vals)
def _compute_qty_stock_vendor(self):
@@ -150,8 +151,9 @@ class ProductProduct(models.Model):
solr_flag = fields.Integer(string='Solr Flag', default=0)
def write(self, vals):
- self.product_tmpl_id.solr_flag = 2
- vals['solr_flag'] = 2
+ if not vals['solr_flag']:
+ self.product_tmpl_id.solr_flag = 2
+ vals['solr_flag'] = 2
return super().write(vals)
def _compute_web_price(self):