[FIX] hr_expense: compute price unit in correct currency

This commit is contained in:
Victor Feyens
2021-12-23 15:30:24 +01:00
parent 03d06865de
commit 15eb4d8795
+5 -2
View File
@@ -222,9 +222,12 @@ class HrExpense(models.Model):
for expense in self.filtered('product_id'):
expense = expense.with_company(expense.company_id)
expense.name = expense.name or expense.product_id.display_name
if not expense.attachment_number or (expense.attachment_number and not expense.unit_amount):
expense.unit_amount = expense.product_id.price_compute('standard_price')[expense.product_id.id]
expense.product_uom_id = expense.product_id.uom_id
if not expense.attachment_number or (expense.attachment_number and not expense.unit_amount):
expense.unit_amount = expense.product_id.price_compute(
'standard_price',
uom=expense.product_uom_id,
currency=expense.currency_id)[expense.product_id.id]
expense.tax_ids = expense.product_id.supplier_taxes_id.filtered(lambda tax: tax.company_id == expense.company_id) # taxes only from the same company
account = expense.product_id.product_tmpl_id._get_product_accounts()['expense']
if account: