diff --git a/addons/web/models/ir_http.py b/addons/web/models/ir_http.py index cbb83ec40e2..f3a6b1f3921 100644 --- a/addons/web/models/ir_http.py +++ b/addons/web/models/ir_http.py @@ -18,4 +18,10 @@ class Http(models.Model): "company_id": request.env.user.company_id.id if request.session.uid else None, "partner_id": request.env.user.partner_id.id if request.session.uid and request.env.user.partner_id else None, "user_companies": {'current_company': (user.company_id.id, user.company_id.name), 'allowed_companies': [(comp.id, comp.name) for comp in user.company_ids]} if display_switch_company_menu else False, + "currencies": self.get_currencies(), } + + def get_currencies(self): + Currency = request.env['res.currency'] + currencies = Currency.search([]).read(['symbol', 'position', 'decimal_places']) + return { c['id']: {'symbol': c['symbol'], 'position': c['position'], 'digits': [69,c['decimal_places']]} for c in currencies} diff --git a/addons/web/static/src/js/framework/session.js b/addons/web/static/src/js/framework/session.js index d882128c67f..06c1303a233 100644 --- a/addons/web/static/src/js/framework/session.js +++ b/addons/web/static/src/js/framework/session.js @@ -187,7 +187,7 @@ var Session = core.Class.extend(mixins.EventDispatcherMixin, { var to_load = _.difference(result, self.module_list).join(','); self.module_list = all_modules; - var loaded = $.when(self.load_currencies(), self.load_translations()); + var loaded = $.when(self.load_translations()); var locale = "/web/webclient/locale/" + self.user_context.lang || 'en_US'; var file_list = [ locale ]; if(to_load.length) { @@ -208,16 +208,6 @@ var Session = core.Class.extend(mixins.EventDispatcherMixin, { }); }); }, - load_currencies: function() { - this.currencies = {}; - var self = this; - return new openerp.web.Model("res.currency").query(["symbol", "position", "decimal_places"]).all() - .then(function(value) { - _.each(value, function(k){ - self.currencies[k.id] = {'symbol': k.symbol, 'position': k.position, 'digits': [69,k.decimal_places]}; - }); - }); - }, load_translations: function() { return _t.database.load_translations(this, this.module_list, this.user_context.lang); },