diff --git a/odex25_base/web_hijri_datepicker/static/src/js/list_renderer.js b/odex25_base/web_hijri_datepicker/static/src/js/list_renderer.js index 72dd522ad..2d27878d8 100644 --- a/odex25_base/web_hijri_datepicker/static/src/js/list_renderer.js +++ b/odex25_base/web_hijri_datepicker/static/src/js/list_renderer.js @@ -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) {} + } + }); + } } }); }); \ No newline at end of file