[FIX] hr_expense: Wrong tax in multi companies

Steps to reproduce the bug:

- Let's consider two companies C1 and C2 where C1 is the parent of C2
- Let's consider an expense product P with T1 as tax in C1 and T2 as tax in C2
- Let's consider an expense alias A defned for C1 and C2
- Let's consider an employee E in C2 with work email address W
- Send from W to A an email with subject [internal reference of P] Test Expense 1000€

Bug:

An expense is created in C2 with T1 and T2 as supplier taxes instead of only T2

Inspired from function _compute_tax_id defined in model sale.order and purchase.order

opw:2507162

closes odoo/odoo#80250

X-original-commit: a3daaf4d3a22e403ca891a1d396380e118020164
Signed-off-by: Laurent Smet <las@openerp.com>
This commit is contained in:
Goffin Simon
2021-11-24 07:56:13 +00:00
parent 539ccabe4f
commit 7a5466a8ec
+1 -1
View File
@@ -703,7 +703,7 @@ Or send your receipts at <a href="mailto:%(email)s?subject=Lunch%%20with%%20cust
'unit_amount': price,
'product_id': product.id if product else None,
'product_uom_id': product.uom_id.id,
'tax_ids': [(4, tax.id, False) for tax in product.supplier_taxes_id],
'tax_ids': [(4, tax.id, False) for tax in product.supplier_taxes_id.filtered(lambda r: r.company_id == company)],
'quantity': 1,
'company_id': company.id,
'currency_id': currency_id.id