From 67901a4429c69fbba96c32af5d8f58aff54f0be5 Mon Sep 17 00:00:00 2001
From: "Julien Alardot (jual)" <jual@odoo.com>
Date: Mon, 7 Aug 2023 13:27:53 +0200
Subject: [PATCH] [FIX] hr_expense: recompute expense currency

Fix a corner case when the expense currency doesn't update when a cost is added to the product

Steps to reproduce:
- Create an expense in a foreign currency
- Add a cost to the expense product

Before fix:
Unit amount currency stays in foreign currency

After fix:
Forces expense currency to
 company currency

task-3455446

closes odoo/odoo#131043

Signed-off-by: Laurent Smet (las) <las@odoo.com>
---
 addons/hr_expense/models/hr_expense.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/addons/hr_expense/models/hr_expense.py b/addons/hr_expense/models/hr_expense.py
index 42a645e91b2d..73b3dc791eee 100644
--- a/addons/hr_expense/models/hr_expense.py
+++ b/addons/hr_expense/models/hr_expense.py
@@ -142,7 +142,7 @@ class HrExpense(models.Model):
         for expense in self:
             expense.same_currency = bool(not expense.company_id or (expense.currency_id and expense.currency_id == expense.company_currency_id))
 
-    @api.depends('product_id')
+    @api.depends('product_id.standard_price')
     def _compute_product_has_cost(self):
         for expense in self:
             expense.product_has_cost = expense.product_id and (float_compare(expense.product_id.standard_price, 0.0, precision_digits=2) != 0)
-- 
GitLab