diff options
| author | Denis Ledoux <dle@odoo.com> | 2014-09-03 18:26:53 +0200 |
|---|---|---|
| committer | Denis Ledoux <dle@odoo.com> | 2014-09-03 18:26:53 +0200 |
| commit | ff0f92acfa0dda7d5407b8d8bb097ae273ef376a (patch) | |
| tree | b35de306542809a73210cc893a3eadd1995534a0 /addons/web/static/src | |
| parent | 00ea919699d0927604a21fdd5bc3974defad8317 (diff) | |
| parent | 73072272de8ab32b0fe199d54a90986dc02d1dbc (diff) | |
[MERGE] forward port of branch 7.0 up to 7307227
Diffstat (limited to 'addons/web/static/src')
| -rw-r--r-- | addons/web/static/src/js/views.js | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index 76fa67231be..2a82ef0664c 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -405,14 +405,35 @@ instance.web.ActionManager = instance.web.Widget.extend({ } var widget = executor.widget(); 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, }); - this.dialog.on("closing", null, options.on_close); + + // 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(); + } + }; + this.dialog.on("closing", null, this.dialog.on_close); this.dialog.dialog_title = executor.action.name; if (widget instanceof instance.web.ViewManager) { _.extend(widget.flags, { @@ -426,6 +447,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; |
