From c289fcaf07839dfd965e6113a853026833ff0743 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Thu, 22 Jun 2023 11:52:09 +0700 Subject: reset variant solr flag if cache reset in manufacture --- indoteknik_custom/models/x_manufactures.py | 11 +++++++---- 1 file 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') -- cgit v1.2.3