[FIX] web: force seession context reload when reloading client

The goal is to ensure that HTTP requests
done while reloading the client (e.g. the
menu bar, etc.) do not use a deprecated
session context.

Also undo the previous fix from a0ee2b5
as it would cause other issues (e.g.
prevent setting the admin password/lang
when creating a new db using the db manager)
This logic does not belong in the business
methods of res.users.
This commit is contained in:
Olivier Dony 2014-07-02 15:18:56 +02:00
parent f0d66ec5c6
commit c887e53b32
2 changed files with 14 additions and 5 deletions

View File

@ -679,6 +679,19 @@ instance.web.Reload = function(parent, action) {
};
instance.web.client_actions.add("reload", "instance.web.Reload");
/**
* Client action to refresh the session context (making sure
* HTTP requests will have the right one) then reload the
* whole interface.
*/
instance.web.ReloadContext = function(parent, action) {
// side-effect of get_session_info is to refresh the session context
instance.session.rpc("/web/session/get_session_info", {}).then(function() {
instance.web.Reload(parent, action);
});
}
instance.web.client_actions.add("reload_context", "instance.web.ReloadContext");
/**
* Client action to go back in breadcrumb history.
* If can't go back in history stack, will go back to home.

View File

@ -322,10 +322,6 @@ class res_users(osv.osv):
if id in self._uid_cache[db]:
del self._uid_cache[db][id]
self.context_get.clear_cache(self)
if request:
if uid in ids and 'lang' in values:
request.session.get_context()
request.session.modified = True
return res
def unlink(self, cr, uid, ids, context=None):
@ -497,7 +493,7 @@ class res_users(osv.osv):
def preference_save(self, cr, uid, ids, context=None):
return {
'type': 'ir.actions.client',
'tag': 'reload',
'tag': 'reload_context',
}
def preference_change_password(self, cr, uid, ids, context=None):