diff options
| author | Christophe Simonis <chs@odoo.com> | 2014-09-04 18:03:24 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2014-09-04 18:03:24 +0200 |
| commit | 41afeec7f14a2bafb976770afe76d24e15b13df6 (patch) | |
| tree | 599c293f9f4999f10e8b8bbea146c764f30f575b /addons/web/static/src/js | |
| parent | 2d9ddce327eb818dd6631b1bf1efb50f9be22540 (diff) | |
| parent | 9363bc9182b3eb70980b3a80e3ea2d4809f44840 (diff) | |
[MERGE] forward port of branch saas-5 up to 9363bc9
Diffstat (limited to 'addons/web/static/src/js')
| -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 18e162e0278..932b560d414 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -410,15 +410,36 @@ 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, { title: executor.action.name, 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); if (widget instanceof instance.web.ViewManager) { _.extend(widget.flags, { $buttons: this.dialog.$buttons, @@ -431,6 +452,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; |
