summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/framework/session.js
diff options
context:
space:
mode:
Diffstat (limited to 'addons/web/static/src/js/framework/session.js')
-rw-r--r--addons/web/static/src/js/framework/session.js16
1 files changed, 15 insertions, 1 deletions
diff --git a/addons/web/static/src/js/framework/session.js b/addons/web/static/src/js/framework/session.js
index 5f6d4c91ea2..8b084f640fd 100644
--- a/addons/web/static/src/js/framework/session.js
+++ b/addons/web/static/src/js/framework/session.js
@@ -40,6 +40,7 @@ var Session = core.Class.extend(mixins.EventDispatcherMixin, {
this.name = "instance0";
// TODO: session store in cookie should be optional
this.qweb_mutex = new utils.Mutex();
+ this.currencies = {};
},
setup: function(origin, options) {
// must be able to customize server
@@ -169,7 +170,7 @@ var Session = core.Class.extend(mixins.EventDispatcherMixin, {
var to_load = _.difference(result, self.module_list).join(',');
self.module_list = all_modules;
- var loaded = self.load_translations();
+ var loaded = $.when(self.load_currencies(), self.load_translations());
var locale = "/web/webclient/locale/" + self.user_context.lang || 'en_US';
var file_list = [ locale ];
if(to_load.length) {
@@ -190,6 +191,16 @@ 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);
},
@@ -240,6 +251,9 @@ var Session = core.Class.extend(mixins.EventDispatcherMixin, {
this.module_loaded[mod] = true;
}
},
+ get_currency: function(currency_id) {
+ return this.currencies[currency_id];
+ },
get_file: function (options) {
if (this.override_session){
options.data.session_id = this.session_id;