From 0fe05527d92a45b38a3670241636b422c1054320 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Wed, 18 Oct 2023 16:36:25 +0700 Subject: add tax if exclude tax in purchase pricelist --- indoteknik_custom/models/purchase_order.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 5e4617d4..59d5ac3e 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -56,6 +56,14 @@ class PurchaseOrder(models.Model): def add_product_to_pricelist(self): for line in self.order_line: current_time = datetime.utcnow() + price_unit = line.price_unit + taxes = line.taxes_id + for tax in taxes: + tax_include = tax.price_include + tax_amt = tax.amount + if taxes: + if not tax_include: + price_unit = price_unit + (price_unit * tax_amt / 100) purchase_pricelist = self.env['purchase.pricelist'].search([ ('product_id', '=', line.product_id.id), -- cgit v1.2.3