[FIX] add option to avoid actions to be pushed as state. Used for login and action extracted from hash. Full state of client actions is pushed.

bzr revid: chs@openerp.com-20121012125418-jbw3iut85riepz47
This commit is contained in:
Christophe Simonis 2012-10-12 14:54:18 +02:00
parent db64cf7097
commit e70d879acc
2 changed files with 9 additions and 6 deletions

View File

@ -1021,15 +1021,13 @@ instance.web.WebClient = instance.web.Client.extend({
var state = $.bbq.getState(true); var state = $.bbq.getState(true);
var action = { var action = {
'type': 'ir.actions.client', type: 'ir.actions.client',
'tag': 'login', tag: 'login',
'params': state _push_me: false,
}; };
this.action_manager.do_action(action); this.action_manager.do_action(action);
this.action_manager.inner_widget.on('login_successful', this, function() { this.action_manager.inner_widget.on('login_successful', this, function() {
this.do_push_state(state);
this._current_state = null; // ensure the state will be loaded
this.show_application(); // will load the state we just pushed this.show_application(); // will load the state we just pushed
}); });
}, },
@ -1105,6 +1103,7 @@ instance.web.WebClient = instance.web.Client.extend({
}); });
}); });
} else { } else {
state._push_me = false; // no need to push state back...
this.action_manager.do_load_state(state, !!this._current_state); this.action_manager.do_load_state(state, !!this._current_state);
} }
} }

View File

@ -164,6 +164,10 @@ instance.web.ActionManager = instance.web.Widget.extend({
state = state || {}; state = state || {};
if (this.getParent() && this.getParent().do_push_state) { if (this.getParent() && this.getParent().do_push_state) {
if (this.inner_action) { if (this.inner_action) {
if (this.inner_action._push_me === false) {
// this action has been explicitly marked as not pushable
return;
}
state['title'] = this.inner_action.name; state['title'] = this.inner_action.name;
if(this.inner_action.type == 'ir.actions.act_window') { if(this.inner_action.type == 'ir.actions.act_window') {
state['model'] = this.inner_action.res_model; state['model'] = this.inner_action.res_model;
@ -172,7 +176,7 @@ instance.web.ActionManager = instance.web.Widget.extend({
state['action'] = this.inner_action.id; state['action'] = this.inner_action.id;
} else if (this.inner_action.type == 'ir.actions.client') { } else if (this.inner_action.type == 'ir.actions.client') {
state['action'] = this.inner_action.tag; state['action'] = this.inner_action.tag;
//state = _.extend(this.inner_action.params || {}, state); state = _.extend(this.inner_action.params || {}, state);
} }
} }
if(!this.dialog) { if(!this.dialog) {