From f369c55dc0b696449eddad6cd30f2db285b49542 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Mon, 29 Jul 2024 15:32:55 +0700 Subject: cr virtual rating --- indoteknik_custom/models/product_template.py | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index c94b523a..56460821 100755 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -117,18 +117,31 @@ class ProductTemplate(models.Model): for product in self: rate = 0 if product.web_price: - rate += 4 + rate += 8 if product.qty_sold > 0: - rate += 3 - if product.have_promotion_program: #have discount from pricelist rate += 5 if product.image_128: - rate += 3 + rate += 7 if product.website_description: - rate += 1 - if product.product_variant_id.qty_stock_vendor > 0: - rate += 2 + rate += 7 + if product.product_variant_id.qty_onhand_bandengan > 0: + rate += 5 + if product.product_variant_id._is_have_flashsale(): + rate += 10 product.virtual_rating = rate + # if product.web_price: + # rate += 4 + # if product.qty_sold > 0: + # rate += 3 + # if product.have_promotion_program: #have discount from pricelist + # rate += 5 + # if product.image_128: + # rate += 3 + # if product.website_description: + # rate += 1 + # if product.product_variant_id.qty_stock_vendor > 0: + # rate += 2 + # product.virtual_rating = rate def unlink(self): if self._name == 'product.template': -- cgit v1.2.3