diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-10-07 11:31:40 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-10-07 11:31:40 +0700 |
| commit | 8f1d508cbceecc9ed32ed1d53331fe41289c23ba (patch) | |
| tree | ffeffc0d8dabd34691a80bcab7ab0a2906a268e3 | |
| parent | 421d1b210b3c19028ba45331b0c476ceafb72523 (diff) | |
Update product_template.py
| -rwxr-xr-x | indoteknik_custom/models/product_template.py | 5 |
1 files changed, 4 insertions, 1 deletions
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: |
