summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Geubelle <mge@odoo.com>2016-06-27 16:20:47 +0200
committerMartin Geubelle <mge@odoo.com>2016-06-27 16:20:47 +0200
commitf8ca7634ca66efcc5e13a7d1e36dbb415fa252d4 (patch)
tree1a1fddb70904a314c67a4baf7e3886eccb6f52a2
parentdb99c65f7b9abe2061d8ae949659a30623bc17a2 (diff)
[FIX] base: rate with correct current user's company
Bug introduced in 7eab8e2. As `self.env.user` is browsed with `sudo`, the result of this call will always return the admin's current company and not the user's current company. opw-681809
-rw-r--r--openerp/addons/base/res/res_currency.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/openerp/addons/base/res/res_currency.py b/openerp/addons/base/res/res_currency.py
index 080c488b378..e5a354b2106 100644
--- a/openerp/addons/base/res/res_currency.py
+++ b/openerp/addons/base/res/res_currency.py
@@ -36,7 +36,7 @@ class Currency(models.Model):
@api.multi
def _compute_current_rate(self):
date = self._context.get('date') or fields.Datetime.now()
- company_id = self._context.get('company_id') or self.env.user._get_company().id
+ company_id = self._context.get('company_id') or self.env['res.users']._get_company().id
# the subquery selects the last rate before 'date' for the given currency/company
query = """SELECT c.id, (SELECT r.rate FROM res_currency_rate r
WHERE r.currency_id = c.id AND r.name <= %s