Fix ListRenderer _onWindowClicked to preserve default datepicker behavior - Final solution

This commit is contained in:
Mohamed Eltayar 2025-09-17 11:59:42 +03:00
parent eb2d2f3fd0
commit 8723a4c578
1 changed files with 17 additions and 8 deletions

View File

@ -151,15 +151,24 @@ odoo.define('web_hijri_datepicker.ListRenderer', function (require) {
},
_onWindowClicked: function (event) {
var $target = $(event.target);
if ($target.hasClass('calendars-highlight') ||
$target.closest('.calendars-popup').length ||
$target.closest('.calendars').length ||
$target.hasClass('o_hijri') ||
$target.closest('.o_hijri').length) {
return;
}
this._super.apply(this, arguments);
var $target = $(event.target);
var isHijriElement = $target.hasClass('calendars-highlight') ||
$target.closest('.calendars-popup').length ||
$target.closest('.calendars').length ||
$target.hasClass('o_hijri') ||
$target.closest('.o_hijri').length;
if (!isHijriElement) {
$('.o_hijri').each(function() {
if ($(this).data && $(this).calendarsPicker) {
try {
$(this).calendarsPicker('hide');
} catch (e) {}
}
});
}
}
});
});