[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
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user