From 021086d5a8ce413e97cbc2cc66a2f2f81ae05978 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 25 Feb 2013 12:06:14 +0100 Subject: [PATCH] [FIX] Search view's drawer closing unexpectedly when using the date widget jquery-ui's date picker (at least in currently used version) lets *some* (but not all) clicks go through. The date picker dialog is added directly to the page body so capturing clicks in a parent widget doesn't work, and these "stray" bubbling clicks will trigger the global bus's "click" event. Add a capturing (and stopPropagation-ing) of these clicks in our wrapper to jquery-ui's datepicker to avoid the issue. lp bug: https://launchpad.net/bugs/1095283 fixed bzr revid: xmo@openerp.com-20130225110614-p7dmmjd41xdxescy --- addons/web/static/src/js/view_form.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index b59838da5e9..81b9eb9bc9e 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2402,6 +2402,11 @@ instance.web.DateTimeWidget = instance.web.Widget.extend({ showButtonPanel: true, firstDay: Date.CultureInfo.firstDayOfWeek }); + // Some clicks in the datepicker dialog are not stopped by the + // datepicker and "bubble through", unexpectedly triggering the bus's + // click event. Prevent that. + this.picker('widget').click(function (e) { e.stopPropagation(); }); + this.$el.find('img.oe_datepicker_trigger').click(function() { if (self.get("effective_readonly") || self.picker('widget').is(':visible')) { self.$input.focus();