From f300408a52eab119568a331c46c1288f18bd7c8e Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Mon, 12 Feb 2024 10:48:37 +0700 Subject: bug fix flashsale price, forgot to divide tax --- indoteknik_api/models/product_product.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indoteknik_api/models') diff --git a/indoteknik_api/models/product_product.py b/indoteknik_api/models/product_product.py index 1db58d8e..4400ad08 100644 --- a/indoteknik_api/models/product_product.py +++ b/indoteknik_api/models/product_product.py @@ -278,11 +278,14 @@ class ProductProduct(models.Model): discount = 0 price_flashsale = 0 + default_divide_tax = float(1.11) if item.price_discount > 0: discount = item.price_discount price_flashsale = base_price - (base_price * discount // 100) + price_flashsale = price_flashsale / default_divide_tax elif item.fixed_price > 0: price_flashsale = item.fixed_price # ask darren for include or exclude + # price_flashsale = price_flashsale / default_divide_tax # darren must fill the fixed price with price exclude discount = (base_price - price_flashsale) // base_price * 100 if price_for == 'odoo': -- cgit v1.2.3 From 0060d2789962593280e91d8ea4251a7c18d6115c Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Mon, 12 Feb 2024 11:14:02 +0700 Subject: bug fix tax in flashsale price if using fixed price --- indoteknik_api/models/product_product.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indoteknik_api/models') diff --git a/indoteknik_api/models/product_product.py b/indoteknik_api/models/product_product.py index 4400ad08..bd6f516d 100644 --- a/indoteknik_api/models/product_product.py +++ b/indoteknik_api/models/product_product.py @@ -279,14 +279,17 @@ class ProductProduct(models.Model): discount = 0 price_flashsale = 0 default_divide_tax = float(1.11) + default_tax = float(11) if item.price_discount > 0: discount = item.price_discount price_flashsale = base_price - (base_price * discount // 100) price_flashsale = price_flashsale / default_divide_tax elif item.fixed_price > 0: price_flashsale = item.fixed_price # ask darren for include or exclude - # price_flashsale = price_flashsale / default_divide_tax # darren must fill the fixed price with price exclude + price_flashsale = price_flashsale + (price_flashsale * default_tax / 100) discount = (base_price - price_flashsale) // base_price * 100 + price_flashsale = item.fixed_price + # price_flashsale = price_flashsale / default_divide_tax # darren must fill the fixed price with price exclude if price_for == 'odoo': base_price = self._v2_get_website_price_exclude_tax() -- cgit v1.2.3 From fb5ef1ffd3a52997044a4bcd1f6bef8cc70861ff Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Mon, 12 Feb 2024 16:37:46 +0700 Subject: bug fix discount zero in flash sale --- indoteknik_api/models/product_product.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indoteknik_api/models') diff --git a/indoteknik_api/models/product_product.py b/indoteknik_api/models/product_product.py index bd6f516d..3ecad627 100644 --- a/indoteknik_api/models/product_product.py +++ b/indoteknik_api/models/product_product.py @@ -287,7 +287,8 @@ class ProductProduct(models.Model): elif item.fixed_price > 0: price_flashsale = item.fixed_price # ask darren for include or exclude price_flashsale = price_flashsale + (price_flashsale * default_tax / 100) - discount = (base_price - price_flashsale) // base_price * 100 + discount = (base_price - price_flashsale) * 100 / base_price + discount = (math.ceil(discount*100)/100) price_flashsale = item.fixed_price # price_flashsale = price_flashsale / default_divide_tax # darren must fill the fixed price with price exclude -- cgit v1.2.3 From 1b321129a53dcd218cab565f7c47210f70c84fdc Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Wed, 21 Feb 2024 14:27:01 +0700 Subject: Update order get active flash sale --- indoteknik_api/models/product_pricelist.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indoteknik_api/models') diff --git a/indoteknik_api/models/product_pricelist.py b/indoteknik_api/models/product_pricelist.py index f05fa82d..0d4247c8 100644 --- a/indoteknik_api/models/product_pricelist.py +++ b/indoteknik_api/models/product_pricelist.py @@ -92,7 +92,7 @@ class ProductPricelist(models.Model): ('is_flash_sale', '=', True), ('start_date', '<=', current_time), ('end_date', '>=', current_time) - ], limit=1) + ], limit=1, order='start_date asc') return pricelist def is_flash_sale_product(self, product_id: int): -- cgit v1.2.3