diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2022-11-03 11:14:12 +0700 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2022-11-03 11:14:12 +0700 |
| commit | 270c7e488aff428a1d8563d5b4e420b6f371e1ef (patch) | |
| tree | 96a8f422ce8eaf94454f0f3a9a1b9ad3b244e85e | |
| parent | fe935087fc710cfed618f051c377ed753571d955 (diff) | |
Fix bug set solr_flag in product.product
| -rwxr-xr-x | indoteknik_custom/models/product_template.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index a812fc28..4c8f664d 100755 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -151,8 +151,10 @@ class ProductProduct(models.Model): solr_flag = fields.Integer(string='Solr Flag', default=0) def write(self, vals): - if 'solr_flag' not in vals and self.solr_flag == 1: - self.product_tmpl_id.solr_flag = 2 + 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) |
