From d20388ba1ae93095b369ffd3519bb06bd1a090f0 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 12 Sep 2017 12:25:34 +0200 Subject: [PATCH] [FIX] purchase: missing data in tax computation - Create a purchase tax computed with Python code. - The Python code must use an attribute of the product, e.g. `product.price`. - Create a PO using the created purchase tax. It crashes, because the product (as well as the partner) is not sent to the `compute_all` method. opw-770078 --- addons/purchase/models/purchase.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/purchase/models/purchase.py b/addons/purchase/models/purchase.py index ec1d25a8e63..9ff1ee0ebf1 100644 --- a/addons/purchase/models/purchase.py +++ b/addons/purchase/models/purchase.py @@ -649,7 +649,9 @@ class PurchaseOrderLine(models.Model): order = line.order_id price_unit = line.price_unit if line.taxes_id: - price_unit = line.taxes_id.with_context(round=False).compute_all(price_unit, currency=line.order_id.currency_id, quantity=1.0)['total_excluded'] + price_unit = line.taxes_id.with_context(round=False).compute_all( + price_unit, currency=line.order_id.currency_id, quantity=1.0, product=line.product_id, partner=line.order_id.partner_id + )['total_excluded'] if line.product_uom.id != line.product_id.uom_id.id: price_unit *= line.product_uom.factor / line.product_id.uom_id.factor if order.currency_id != order.company_id.currency_id: