From 7894d2cfb28420e6ca3be25b33c5e067dbd5f22a Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Tue, 16 Oct 2012 12:32:52 +0200 Subject: [PATCH] [IMP] Made $buttons in dialogs work all the time bzr revid: nicolas.vanhoren@openerp.com-20121016103252-njyt4rxk96fy5w6r --- addons/web/static/src/js/chrome.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index 54d26c5ec5b..5c7eb8524e6 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -129,13 +129,10 @@ instance.web.Dialog = instance.web.Widget.extend({ if (! this.dialog_inited) this.init_dialog(); var o = this.get_options(options); - if (! this.params_buttons) { - this.$buttons.appendTo($("body")); - } + this.$buttons.appendTo($("body")); instance.web.dialog(this.$el, o).dialog('open'); - if (! this.params_buttons) { - this.$buttons.appendTo(this.$el.dialog("widget")); - } + this.$el.dialog("widget").find(".ui-dialog-buttonpane").remove(); + this.$buttons.appendTo(this.$el.dialog("widget")); if (o.height === 'auto' && o.max_height) { this.$el.css({ 'max-height': o.max_height, 'overflow-y': 'auto' }); } @@ -148,6 +145,8 @@ instance.web.Dialog = instance.web.Widget.extend({ if (! this.params_buttons) { this.$buttons = $('
'); this.$el.dialog("widget").append(this.$buttons); + } else { + this.$buttons = this.$el.dialog("widget").find(".ui-dialog-buttonpane"); } this.dialog_inited = true; var res = this.start();