diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2023-06-22 11:52:09 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2023-06-22 11:52:09 +0700 |
| commit | c289fcaf07839dfd965e6113a853026833ff0743 (patch) | |
| tree | 795ee63bef9fee56c09678de07b2069e74058a1b | |
| parent | 59d2b16d8b2820476a68449ace57703a2e725a39 (diff) | |
reset variant solr flag if cache reset in manufacture
| -rwxr-xr-x | indoteknik_custom/models/x_manufactures.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/indoteknik_custom/models/x_manufactures.py b/indoteknik_custom/models/x_manufactures.py index 710bfe8a..e48a5367 100755 --- a/indoteknik_custom/models/x_manufactures.py +++ b/indoteknik_custom/models/x_manufactures.py @@ -61,13 +61,16 @@ class XManufactures(models.Model): ('cache_reset_status', '=', 'reset'), ]) for manufacture in manufactures: - products = self.env['product.template'].search([ + templates = self.env['product.template'].search([ ('x_manufacture', '=', manufacture.id), ('solr_flag', '=', 1), ]) - for product in products: - product.solr_flag = 2 - _logger.info("Reset Solr Flag to 2 %s" % product.id) + for template in templates: + template.solr_flag = 2 + _logger.info("Reset Solr Flag template to 2 %s" % template.id) + for variant in template.product_variant_ids: + variant.solr_flag = 2 + _logger.info("Reset Solr Flag variant to 2 %s" % variant.id) manufacture.cache_reset_status = 'done' @api.onchange('x_name','image_promotion_1','image_promotion_2') |
