From d58dbe6fb235570d1b9ca0824556847baea108ef Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Wed, 4 Oct 2023 09:07:18 +0700 Subject: Fixing calculate website price on product --- indoteknik_api/models/product_product.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/indoteknik_api/models/product_product.py b/indoteknik_api/models/product_product.py index 559ad35c..e3de8f86 100644 --- a/indoteknik_api/models/product_product.py +++ b/indoteknik_api/models/product_product.py @@ -64,22 +64,22 @@ class ProductProduct(models.Model): price_tier = pricelist.get_tier_level() price_tier = price_tier if price_tier else default_price_tier - price = self._get_pricelist_tier(price_tier) + pricelist = self._get_pricelist_tier(price_tier) discount_key = f'discount_tier{price_tier}' price_key = f'price_tier{price_tier}' - - discount_percentage = price.get(discount_key, 0) - price_discount = price.get(price_key, 0) - + + price = self._v2_get_website_price_exclude_tax() + discount_percentage = pricelist.get(discount_key, 0) + price_discount = pricelist.get(price_key, 0) + flashsale = self._get_flashsale_price() flashsale_price = flashsale.get('flashsale_price', 0) flashsale_discount = flashsale.get('flashsale_discount', 0) if flashsale_price > 0 and flashsale_price < price_discount: price_discount = flashsale_price discount_percentage = flashsale_discount - - price = self._get_website_price_exclude_tax() + return { 'price': price, 'discount_percentage': discount_percentage, -- cgit v1.2.3