diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-10-07 10:39:46 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-10-07 10:39:46 +0700 |
| commit | 421d1b210b3c19028ba45331b0c476ceafb72523 (patch) | |
| tree | 922a567a2f5ec88ba4a7fe3d6d4c07bddb688203 /indoteknik_api/models | |
| parent | d6501fd1c30eab8686e87595327ee2887e587a49 (diff) | |
| parent | ed2ae23c3bff0c97f8b159ad1dad0a2c93cc2ef3 (diff) | |
Merge commit 'ed2ae23c3bff0c97f8b159ad1dad0a2c93cc2ef3'
Diffstat (limited to 'indoteknik_api/models')
| -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, |
