diff options
| author | Christophe Simonis <chs@odoo.com> | 2014-09-04 17:51:42 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2014-09-04 17:51:42 +0200 |
| commit | 9363bc9182b3eb70980b3a80e3ea2d4809f44840 (patch) | |
| tree | e30c6c89fb35ca558e904abb33070ba3a807ec40 /addons/web/static/src | |
| parent | 05683f05b535cab94f9e01dae1f4701428c38020 (diff) | |
| parent | 3d80dc2bbfcda08e787159d2711ac0dc56f81ad6 (diff) | |
[MERGE] forward port of branch saas-3 up to 3d80dc2
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 53addf97e56..f8f2d758b9a 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -405,15 +405,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, @@ -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; |
