diff options
| author | Géry Debongnie <ged@odoo.com> | 2016-05-25 12:18:48 +0200 |
|---|---|---|
| committer | Géry Debongnie <ged@odoo.com> | 2016-05-30 09:23:07 +0200 |
| commit | 9c68bc74827864a3c6c21be8ead1b2ed3d122d73 (patch) | |
| tree | e9dec0618783fbce6d12e89369fa064c63dc886b /addons/web/static/src/js/framework/session.js | |
| parent | 2a8a17024d2b46f3f8837a8672334a7dff3abd1b (diff) | |
[REF] point_of_sale,web(site): move session info into page source
This commit introduces a mechanism to add information into the session
from a different module, without having to fetch it manually with a rpc.
This is intended to be used with small pieces of info required at the
start of the web client, such as currency informations.
To add information to the session, one can simply inherit from ir.http
and modify the session_info method.
Diffstat (limited to 'addons/web/static/src/js/framework/session.js')
| -rw-r--r-- | addons/web/static/src/js/framework/session.js | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/addons/web/static/src/js/framework/session.js b/addons/web/static/src/js/framework/session.js index d848fd4c511..d882128c67f 100644 --- a/addons/web/static/src/js/framework/session.js +++ b/addons/web/static/src/js/framework/session.js @@ -136,7 +136,7 @@ var Session = core.Class.extend(mixins.EventDispatcherMixin, { }, user_has_group: function(group) { if (!this.uid) { - return $.when().resolve(false); + return $.when(false); } var def = this._groups_def[group]; if (!def) { @@ -293,11 +293,10 @@ var Session = core.Class.extend(mixins.EventDispatcherMixin, { * @returns {$.Deferred} deferred indicating the session is done reloading */ session_reload: function () { - var self = this; - return self.rpc("/web/session/get_session_info", {}).then(function(result) { - delete result.session_id; - _.extend(self, result); - }); + var result = _.extend({}, window.odoo.session_info); + delete result.session_id; + _.extend(this, result); + return $.when(); }, check_session_id: function() { var self = this; |
