[IMP] Made $buttons in dialogs work all the time

bzr revid: nicolas.vanhoren@openerp.com-20121016103252-njyt4rxk96fy5w6r
This commit is contained in:
niv-openerp 2012-10-16 12:32:52 +02:00
parent e8c0f38927
commit 7894d2cfb2
1 changed files with 5 additions and 6 deletions

View File

@ -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 = $('<div class="ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" />');
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();