[IMP] web: extra comments to explain commit 57b4860

Added some cryptic comments so we remember a bit
why we have a complicated dance with on_close.
Basically we do not want to reload the
original form view until the last popup is closed,
in the case where several wizard (steps) are opened
one after the other.
This commit is contained in:
Olivier Dony 2014-09-02 19:42:24 +02:00
parent c77c3f934c
commit c0d838ddb3
1 changed files with 14 additions and 0 deletions

View File

@ -375,18 +375,29 @@ instance.web.ActionManager = instance.web.Widget.extend({
if (executor.action.target === 'new') {
var pre_dialog = this.dialog;
if (pre_dialog){
// prevent previous dialog to consider itself closed,
// right now, as we're opening a new one (prevents
// reload of original form view)
pre_dialog.off('closing', null, pre_dialog.on_close);
}
if (this.dialog_widget && !this.dialog_widget.isDestroyed()) {
this.dialog_widget.destroy();
}
// explicitly passing a closing action to dialog_stop() prevents
// it from reloading the original form view
this.dialog_stop(executor.action);
this.dialog = new instance.web.Dialog(this, {
dialogClass: executor.klass,
});
// chain on_close triggers with previous dialog, if any
this.dialog.on_close = function(){
options.on_close.apply(null, arguments);
if (pre_dialog && pre_dialog.on_close){
// no parameter passed to on_close as this will
// only be called when the last dialog is truly
// closing, and *should* trigger a reload of the
// underlying form view (see comments above)
pre_dialog.on_close();
}
};
@ -404,6 +415,9 @@ instance.web.ActionManager = instance.web.Widget.extend({
this.dialog.open();
return initialized;
} else {
// explicitly passing a closing action to dialog_stop() prevents
// it from reloading the original form view - we're opening a
// completely new action anyway
this.dialog_stop(executor.action);
this.inner_action = executor.action;
this.inner_widget = widget;