diff options
| -rwxr-xr-x | indoteknik_custom/models/product_template.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index ccbc9ff6..b1dcabb6 100755 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -86,10 +86,13 @@ class ProductTemplate(models.Model): ('type', '=', 'product'), ('active', '=', True), ('last_calculate_rating', '=', False), + # ('id', '=', 22798), ], limit=10000) + for product in products: # print("Calculate Rating Product ", product) _logger.info("Calculate Rating Product %s" % product.id) + product_variant = self.env['product.product'].search([('product_tmpl_id', '=', product.id)], limit=1) rate = 0 if product.web_price: rate += 1 @@ -100,6 +103,8 @@ class ProductTemplate(models.Model): rate += 1 if product.website_description: rate += 1 + if product_variant.qty_stock_vendor > 0: + rate += 1 product.product_rating = rate product.last_calculate_rating = current_time @@ -108,8 +113,10 @@ class ProductTemplate(models.Model): ('active', '=', True), ('last_calculate_rating', '<', delta_time), ], limit=10000) + for product in products: print("Calculate Rating Product OutOfDate", product) + product_variant = self.env['product.product'].search([('product_tmpl_id', '=', product.id)], limit=1) rate = 0 if product.web_price: rate += 1 @@ -120,6 +127,8 @@ class ProductTemplate(models.Model): rate += 1 if product.website_description: rate += 1 + if product_variant.qty_stock_vendor > 0: + rate += 1 product.product_rating = rate product.last_calculate_rating = current_time |
