[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
This commit is contained in:
Xavier Morel 2013-02-25 12:06:14 +01:00
parent 932a63ce36
commit 021086d5a8
1 changed files with 5 additions and 0 deletions

View File

@ -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();