[IMP] made pager disappear in form view when in create mode
bzr revid: nicolas.vanhoren@openerp.com-20120726115742-jjihwmc0uzw11bn0
This commit is contained in:
parent
e3c2297d43
commit
9375df5ae7
|
@ -92,6 +92,8 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
|
||||||
this.has_been_loaded.then(function() {
|
this.has_been_loaded.then(function() {
|
||||||
self.on("change:actual_mode", self, self.check_actual_mode);
|
self.on("change:actual_mode", self, self.check_actual_mode);
|
||||||
self.check_actual_mode();
|
self.check_actual_mode();
|
||||||
|
self.on("change:actual_mode", self, self.init_pager);
|
||||||
|
self.init_pager();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
destroy: function() {
|
destroy: function() {
|
||||||
|
@ -136,17 +138,6 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
|
||||||
this.$buttons.on('click','.oe_form_button_save',this.on_button_save);
|
this.$buttons.on('click','.oe_form_button_save',this.on_button_save);
|
||||||
this.$buttons.on('click','.oe_form_button_cancel',this.on_button_cancel);
|
this.$buttons.on('click','.oe_form_button_cancel',this.on_button_cancel);
|
||||||
|
|
||||||
this.$pager = $(QWeb.render("FormView.pager", {'widget':self}));
|
|
||||||
if (this.options.$pager) {
|
|
||||||
this.$pager.appendTo(this.options.$pager);
|
|
||||||
} else {
|
|
||||||
this.$element.find('.oe_form_pager').replaceWith(this.$pager);
|
|
||||||
}
|
|
||||||
this.$pager.on('click','a[data-pager-action]',function() {
|
|
||||||
var action = $(this).data('pager-action');
|
|
||||||
self.on_pager_action(action);
|
|
||||||
});
|
|
||||||
|
|
||||||
this.$sidebar = this.options.$sidebar || this.$element.find('.oe_form_sidebar');
|
this.$sidebar = this.options.$sidebar || this.$element.find('.oe_form_sidebar');
|
||||||
if (!this.sidebar && this.options.$sidebar) {
|
if (!this.sidebar && this.options.$sidebar) {
|
||||||
this.sidebar = new instance.web.Sidebar(this);
|
this.sidebar = new instance.web.Sidebar(this);
|
||||||
|
@ -396,6 +387,24 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
|
||||||
this.reload();
|
this.reload();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
init_pager: function() {
|
||||||
|
var self = this;
|
||||||
|
if (this.$pager)
|
||||||
|
this.$pager.remove();
|
||||||
|
if (this.get("actual_mode") === "create")
|
||||||
|
return;
|
||||||
|
this.$pager = $(QWeb.render("FormView.pager", {'widget':self}));
|
||||||
|
if (this.options.$pager) {
|
||||||
|
this.$pager.appendTo(this.options.$pager);
|
||||||
|
} else {
|
||||||
|
this.$element.find('.oe_form_pager').replaceWith(this.$pager);
|
||||||
|
}
|
||||||
|
this.$pager.on('click','a[data-pager-action]',function() {
|
||||||
|
var action = $(this).data('pager-action');
|
||||||
|
self.on_pager_action(action);
|
||||||
|
});
|
||||||
|
this.do_update_pager();
|
||||||
|
},
|
||||||
do_update_pager: function(hide_index) {
|
do_update_pager: function(hide_index) {
|
||||||
var index = hide_index ? '-' : this.dataset.index + 1;
|
var index = hide_index ? '-' : this.dataset.index + 1;
|
||||||
this.$pager.find('button').prop('disabled', this.dataset.ids.length < 2).end()
|
this.$pager.find('button').prop('disabled', this.dataset.ids.length < 2).end()
|
||||||
|
|
Loading…
Reference in New Issue