Skip to content
Snippets Groups Projects
Commit cda8bdc8 authored by Olivier Colson's avatar Olivier Colson
Browse files

[FIX] base: res.currency: use company_id context value as an integer id (not...

[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.
parent fbec51f4
Branches
Tags
No related merge requests found
......@@ -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:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment