[FIX] web: form_view: unnecessary jumping Edit button

When opening a record from a list view, the Edit button in the control panel
sometimes bounced. This was because we listened to event 'mouseup', and
astonishingly, the 'mouseup' event of the click in the list view was catched
by the form view.

The reason why we listened to 'mouseup' instead of 'click' is that some
widgets need the event to be propagated to the body. So this fix simply makes
the form view listen to 'click' instead of 'mouseup', but removes the call to
stopPropagation() on the catched event.
This commit is contained in:
Aaron Bohy
2016-04-25 11:29:59 +02:00
parent 6719df5988
commit 69cb6088be
+2 -4
View File
@@ -109,11 +109,9 @@ var FormView = View.extend(common.FieldManagerMixin, {
this.has_been_loaded.resolve();
// Add bounce effect on button 'Edit' when click on readonly page view.
this.$(".oe_title,.o_group").on('mouseup', function (e) { // 'mouseup' event because some widget need bootstrap click event to go up to body
this.$(".oe_title,.o_group").on('click', function (e) {
if(self.get("actual_mode") === "view" && self.$buttons && !$(e.target).is('[data-toggle]')) {
var $button = self.$buttons.find(".o_form_button_edit");
$button.openerpBounce();
e.stopPropagation();
self.$buttons.find(".o_form_button_edit").openerpBounce();
core.bus.trigger('click', e);
}
});