Skip to content
Snippets Groups Projects
Commit c49a3ef0 authored by Ahmad Khanalizadeh's avatar Ahmad Khanalizadeh
Browse files

[FIX] base: use time zone aware display field for currency rates


Steps to reproduce:

1. change system and admin's time zone to one with a different
date than UTC
2. enable multi-currency in the accounting module
3. add rates for the current date in local time zone and UTC
4. go to settings > currencies
5. the rate for the UTC date is displayed

To fix this, we should use a time zone aware field in `res_currency`.

opw-2945108

closes odoo/odoo#101640

X-original-commit: 2f1d8d6d
Signed-off-by: default avatarWilliam André (wan) <wan@odoo.com>
Signed-off-by: default avatarKhanalizadeh Ahmad (khah) <khah@odoo.com>
parent 5edc915b
No related branches found
No related tags found
No related merge requests found
......@@ -63,7 +63,7 @@ class Currency(models.Model):
@api.depends('rate_ids.rate')
def _compute_current_rate(self):
date = self._context.get('date') or fields.Date.today()
date = self._context.get('date') or fields.Date.context_today(self)
company = self.env['res.company'].browse(self._context.get('company_id')) or self.env.company
# the subquery selects the last rate before 'date' for the given currency/company
currency_rates = self._get_rates(company, date)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment