[FIX] Fixed notebooks tab switching bug with on_changes. Improved notebook tab index initialization on new record creation.
bzr revid: fme@openerp.com-20110808120500-06aph84ix0axl3hc
This commit is contained in:
@@ -679,6 +679,16 @@ openerp.base.form.WidgetNotebook = openerp.base.form.Widget.extend({
|
||||
start: function() {
|
||||
this._super.apply(this, arguments);
|
||||
this.$element.tabs();
|
||||
this.view.on_button_new.add_last(this.do_select_first_visible_tab);
|
||||
},
|
||||
do_select_first_visible_tab: function() {
|
||||
for (var i = 0; i < this.pages.length; i++) {
|
||||
var page = this.pages[i];
|
||||
if (page.invisible === false) {
|
||||
this.$element.tabs('select', page.index);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -696,8 +706,8 @@ openerp.base.form.WidgetNotebookPage = openerp.base.form.WidgetFrame.extend({
|
||||
this.$element_tab = $('#' + this.element_tab_id);
|
||||
},
|
||||
update_dom: function() {
|
||||
if (this.invisible) {
|
||||
this.notebook.$element.tabs('select', 0);
|
||||
if (this.invisible && this.index === this.notebook.$element.tabs('option', 'selected')) {
|
||||
this.notebook.do_select_first_visible_tab();
|
||||
}
|
||||
this.$element_tab.toggle(!this.invisible);
|
||||
this.$element.toggle(!this.invisible);
|
||||
|
||||
Reference in New Issue
Block a user