diff options
| author | niv-openerp <nicolas.vanhoren@openerp.com> | 2012-10-19 15:28:27 +0200 |
|---|---|---|
| committer | niv-openerp <nicolas.vanhoren@openerp.com> | 2012-10-19 15:28:27 +0200 |
| commit | d715d3944099a76deab0ca2497cbce4eb3834d97 (patch) | |
| tree | e1b3405f59888cb40598ee28016613812809eafd /addons/web/static/src | |
| parent | 583f26d691eb11ca238b58fcaddfac4d9a3928a0 (diff) | |
[FIX] Problem with wizards: when the dialog is closed the view is not destroyed
bzr revid: nicolas.vanhoren@openerp.com-20121019132827-y3tp1298w1h359kh
Diffstat (limited to 'addons/web/static/src')
| -rw-r--r-- | addons/web/static/src/js/views.js | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index 705bc1b214e..3e4f35091e6 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -299,6 +299,8 @@ instance.web.ActionManager = instance.web.Widget.extend({ } var widget = executor.widget(); if (executor.action.target === 'new') { + 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, { buttons: {"Close": function() {$(this).dialog("close")}}, @@ -306,8 +308,6 @@ instance.web.ActionManager = instance.web.Widget.extend({ }); this.dialog.on("closing", null, options.on_close); this.dialog.init_dialog(); - } else { - this.dialog_widget.destroy(); } this.dialog.dialog_title = executor.action.name; if (widget instanceof instance.web.ViewManager) { @@ -317,6 +317,7 @@ instance.web.ActionManager = instance.web.Widget.extend({ }); } this.dialog_widget = widget; + this.dialog_widget.setParent(this.dialog); var initialized = this.dialog_widget.appendTo(this.dialog.$el); this.dialog.open(); return initialized; @@ -914,8 +915,17 @@ instance.web.ViewManagerAction = instance.web.ViewManager.extend({ view.set({ 'title': this.action.name }); return r; }, + get_action_manager: function() { + var cur = this; + while (cur = cur.getParent()) { + if (cur instanceof instance.web.ActionManager) { + return cur; + } + } + return undefined; + }, set_title: function(title) { - this.$el.find('.oe_breadcrumb_title:first').html(this.getParent().get_title()); + this.$el.find('.oe_breadcrumb_title:first').html(this.get_action_manager().get_title()); }, do_push_state: function(state) { if (this.getParent() && this.getParent().do_push_state) { |
