From 4601b044a6e4dbf162cfca9bf0be5ff2a21dd4f5 Mon Sep 17 00:00:00 2001
From: Denis Ledoux <dle@odoo.com>
Date: Tue, 7 Jun 2016 16:42:49 +0200
Subject: [PATCH] [FIX] web: prevent search dropdowns to close on click inside

In the Filters, Group By and Favorites dropdowns,
when clicking outside the `li` elements but still
inside the dropdown menu itself
(like on the dividers,
or next to the advanced search `Apply` button),
the dropdowns was closed.

This behavior was annoying when doing an advanced search
with a field using the datetime picker, as, to close the datetime
picker, you have to click outside it, and when you did, it closed
automatically the filter dropdown... So you had to open it again to
finally apply the filter.

opw-674310
---
 addons/web/static/src/js/control_panel.js | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/addons/web/static/src/js/control_panel.js b/addons/web/static/src/js/control_panel.js
index 5e2cc36a6a12..18a03d8d55c3 100644
--- a/addons/web/static/src/js/control_panel.js
+++ b/addons/web/static/src/js/control_panel.js
@@ -67,6 +67,11 @@ var ControlPanel = Widget.extend({
             $switch_buttons: this.$('.oe-cp-switch-buttons'),
         };
 
+        // Prevent the search dropdowns to close when clicking inside them
+        this.$el.on('click.bs.dropdown', '.oe-search-options .dropdown-menu', function (e) {
+            e.stopPropagation();
+        });
+
         // By default, hide the ControlPanel and remove its contents from the DOM
         this._toggle_visibility(false);
 
-- 
GitLab