From 8f1d508cbceecc9ed32ed1d53331fe41289c23ba Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Fri, 7 Oct 2022 11:31:40 +0700 Subject: Update product_template.py --- indoteknik_custom/models/product_template.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index 49f903e4..2293f3b8 100755 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -24,6 +24,7 @@ class ProductTemplate(models.Model): have_promotion_program = fields.Boolean('Have Promotion Program', compute='_have_promotion_program', help="Punya promotion program gak?") product_rating = fields.Float('Product Rating', help="Digunakan untuk sorting product di website") last_calculate_rating = fields.Datetime("Last Calculate Rating") + web_price_sorting = fields.Float('Web Price Sorting', help='Hanya digunakan untuk sorting di web, harga tidak berlaku') def _compute_web_price(self): for template in self: @@ -46,7 +47,7 @@ class ProductTemplate(models.Model): @api.model def _calculate_rating_product(self): current_time = datetime.now() - delta_time = current_time - timedelta(days=60) + delta_time = current_time - timedelta(days=30) current_time = current_time.strftime('%Y-%m-%d %H:%M:%S') delta_time = delta_time.strftime('%Y-%m-%d %H:%M:%S') @@ -61,6 +62,7 @@ class ProductTemplate(models.Model): rate = 0 if product.web_price: rate += 1 + product.web_price_sorting = product.web_price if product.have_promotion_program: rate += 1 if product.image_128: @@ -78,6 +80,7 @@ class ProductTemplate(models.Model): rate = 0 if product.web_price: rate += 1 + product.web_price_sorting = product.web_price if product.have_promotion_program: rate += 1 if product.image_128: -- cgit v1.2.3