[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.
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user