summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indoteknik_api/models/product_pricelist.py25
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,