From cda8bdc8b371429c7f88326a99cb5ebf6c446a1d Mon Sep 17 00:00:00 2001 From: Olivier Colson Date: Tue, 29 May 2018 13:33:51 +0200 Subject: [PATCH] [FIX] base: res.currency: use company_id context value as an integer id (not as a model reference) as it used to be before refactoring. The use of id and model reference was inconsistent for this variable, depending on the content of the context. Doing this caused a failure when trying to load some financial reports (> Balance Sheet, Spanish reports, ...) of accounting in multi company, if both companies had not the same currency. --- odoo/addons/base/models/res_currency.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odoo/addons/base/models/res_currency.py b/odoo/addons/base/models/res_currency.py index 4e36221f1ef..94ca8b3baaa 100644 --- a/odoo/addons/base/models/res_currency.py +++ b/odoo/addons/base/models/res_currency.py @@ -61,7 +61,7 @@ class Currency(models.Model): @api.depends('rate_ids.rate') def _compute_current_rate(self): date = self._context.get('date') or fields.Date.today() - company = self._context.get('company_id') or self.env['res.users']._get_company() + company = self.env['res.company'].browse(self._context.get('company_id')) or self.env['res.users']._get_company() # the subquery selects the last rate before 'date' for the given currency/company currency_rates = self._get_rates(company, date) for currency in self: