From 8a3d2c474483a79e1e4efbc067881a91d2f7a2bd Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Thu, 15 Nov 2012 16:10:46 +0100 Subject: [PATCH] [FIX] For act window target new, always use a new dialog object Buttons footer hack in dialogs makes reusability of dialog impossible bzr revid: fme@openerp.com-20121115151046-0r8xz85racjta7p3 --- addons/web/static/src/js/views.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index 6a0294c3d88..d804bd57cf8 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -25,6 +25,7 @@ instance.web.ActionManager = instance.web.Widget.extend({ dialog_stop: function () { if (this.dialog) { this.dialog.destroy(); + this.dialog = null; } }, /** @@ -310,15 +311,15 @@ instance.web.ActionManager = instance.web.Widget.extend({ } var widget = executor.widget(); if (executor.action.target === 'new') { - if (this.dialog_widget && ! this.dialog_widget.isDestroyed()) + if (this.dialog_widget && !this.dialog_widget.isDestroyed()) { this.dialog_widget.destroy(); - if (this.dialog === null || this.dialog.isDestroyed()) { - this.dialog = new instance.web.Dialog(this, { - dialogClass: executor.klass, - }); - this.dialog.on("closing", null, options.on_close); - this.dialog.init_dialog(); } + this.dialog_stop(); + this.dialog = new instance.web.Dialog(this, { + dialogClass: executor.klass, + }); + this.dialog.on("closing", null, options.on_close); + this.dialog.init_dialog(); this.dialog.dialog_title = executor.action.name; if (widget instanceof instance.web.ViewManager) { _.extend(widget.flags, {