From 58483fcd65cc0515afa343876a94e0a9d17c64a2 Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Thu, 19 Apr 2012 22:44:18 +0200 Subject: [PATCH] [IMP] form change cancel button into discard link bzr revid: al@openerp.com-20120419204418-mn8r1w624j4ba46o --- addons/web/static/src/js/view_form.js | 16 ++++++++-------- addons/web/static/src/xml/base.xml | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 1d17e1acab0..c457554e44b 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -88,13 +88,12 @@ instance.web.FormView = instance.web.View.extend({ } else { this.$element.find('.oe_form_buttons').replaceWith(this.$buttons); } - this.$buttons - .on('click','button.oe_form_button_save',this.on_button_save) - .on('click','button.oe_form_button_cancel',this.on_button_cancel) - .on('click','button.oe_form_button_edit',this.on_button_edit) - .on('click','button.oe_form_button_create',this.on_button_create) - .on('click','button.oe_form_button_duplicate',this.on_button_duplicate) - .on('click','button.oe_form_button_delete',this.on_button_delete); + this.$buttons.on('click','.oe_form_button_create',this.on_button_create); + this.$buttons.on('click','.oe_form_button_edit',this.on_button_edit); + this.$buttons.on('click','.oe_form_button_duplicate',this.on_button_duplicate); + this.$buttons.on('click','.oe_form_button_delete',this.on_button_delete); + 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.$pager = $(QWeb.render("FormView.pager", {'widget':self})); if (this.options.$pager) { @@ -519,10 +518,11 @@ instance.web.FormView = instance.web.View.extend({ self.set({mode: "view"}); }); }, - on_button_cancel: function() { + on_button_cancel: function(event) { if (this.can_be_discarded()) { this.set({mode: "view"}); } + return false; }, on_button_new: function() { var self = this; diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index b47c8d01684..b11eadde42d 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -715,8 +715,8 @@ - - + or + Discard