[IMP] web: move currency rpc to session_info
This commit is contained in:
@@ -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}
|
||||
|
||||
@@ -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);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user