diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2024-02-28 14:07:47 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2024-02-28 14:07:47 +0700 |
| commit | 00b6739e4f4228c1cc66de0ef63312bc633ae21f (patch) | |
| tree | 85f8fc83d4030878893599abb2a949e5d478e3e7 /indoteknik_api/models | |
| parent | 0738a192409687790c16c757f85fe440cb1f377d (diff) | |
| parent | 46a7cc5601ceab2a7a6cdf4d74e0fa26ce13ab8a (diff) | |
Merge branch 'production' into purchasing-job
Diffstat (limited to 'indoteknik_api/models')
| -rw-r--r-- | indoteknik_api/models/product_pricelist.py | 2 | ||||
| -rw-r--r-- | indoteknik_api/models/product_product.py | 9 |
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() |
