diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2022-10-07 08:52:24 +0700 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2022-10-07 08:52:24 +0700 |
| commit | 69a632f84aff35bf7f57005190dee07f9a6d7040 (patch) | |
| tree | 298b3a1605fdf92db9158c96f6a62504e1d6d34a | |
| parent | 1c18f6c7438537a60f181d089df06a0b4ba915f9 (diff) | |
FIx bug api flash sale
| -rw-r--r-- | indoteknik_api/models/product_pricelist.py | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/indoteknik_api/models/product_pricelist.py b/indoteknik_api/models/product_pricelist.py index 3a807f3a..f40efd5d 100644 --- a/indoteknik_api/models/product_pricelist.py +++ b/indoteknik_api/models/product_pricelist.py @@ -35,20 +35,21 @@ class ProductPricelist(models.Model): is_compute_formula = False else: is_compute_formula = False - - product = self.env['product.product'].browse(product_id) - if product: - for tax in product.taxes_id: - if not tax.price_include: - price *= (100 + tax.amount) / 100 - + price_discount = price - for discount in discounts: - price_discount *= (100 - discount) / 100 - discount_percentage = 0 - if len(discounts) > 0: - discount_percentage = (price - price_discount) / price * 100 + if price > 0: + product = self.env['product.product'].browse(product_id) + if product: + for tax in product.taxes_id: + if not tax.price_include: + price *= (100 + tax.amount) / 100 + + for discount in discounts: + price_discount *= (100 - discount) / 100 + + if len(discounts) > 0: + discount_percentage = (price - price_discount) / price * 100 return { 'price': price, |
