summaryrefslogtreecommitdiff
path: root/indoteknik_api/models
diff options
context:
space:
mode:
Diffstat (limited to 'indoteknik_api/models')
-rw-r--r--indoteknik_api/models/product_pricelist.py2
-rw-r--r--indoteknik_api/models/product_product.py9
2 files changed, 9 insertions, 2 deletions
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):
diff --git a/indoteknik_api/models/product_product.py b/indoteknik_api/models/product_product.py
index 1db58d8e..3ecad627 100644
--- a/indoteknik_api/models/product_product.py
+++ b/indoteknik_api/models/product_product.py
@@ -278,12 +278,19 @@ 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
- discount = (base_price - price_flashsale) // base_price * 100
+ price_flashsale = price_flashsale + (price_flashsale * default_tax / 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
if price_for == 'odoo':
base_price = self._v2_get_website_price_exclude_tax()