[FIX] purchase: purchase VATs in a multi-company

Steps to reproduce the bug:

- Create two companies C1 and C2 where C2 is the child of C1
- Create two purchase taxes T1 and T2 where T1 is in C1 and C2 is in T2
- Create a prodcuct P with T1 and T2 as supplier taxes
- Be in C1 as current company
- Create a RFQ and add P

Bug:

T1 and T2 were set on the order line of P instead of T1

PS: This fix is insired from product_id_change in model sale.order.line

opw:2032113

closes odoo/odoo#34658

Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
This commit is contained in:
Goffin Simon
2019-07-08 12:09:51 +00:00
parent a3e504eff5
commit 88a12afdf4
+1 -6
View File
@@ -577,12 +577,7 @@ class PurchaseOrderLine(models.Model):
if product_lang.description_purchase:
self.name += '\n' + product_lang.description_purchase
fpos = self.order_id.fiscal_position_id
if self.env.uid == SUPERUSER_ID:
company_id = self.env.user.company_id.id
self.taxes_id = fpos.map_tax(self.product_id.supplier_taxes_id.filtered(lambda r: r.company_id.id == company_id))
else:
self.taxes_id = fpos.map_tax(self.product_id.supplier_taxes_id)
self._compute_tax_id()
self._suggest_quantity()
self._onchange_quantity()