From e1dd9af9bfae03e15895d735f94b5700f6155b2f Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Fri, 17 Feb 2017 20:30:27 +0100 Subject: [PATCH] [FIX] inhibit closing the menu when selecting from the dropdown --- .../static/src/js/web_advanced_search_x2x.js | 21 +++++++++++++++++-- web_advanced_search_x2x/views/templates.xml | 2 +- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/web_advanced_search_x2x/static/src/js/web_advanced_search_x2x.js b/web_advanced_search_x2x/static/src/js/web_advanced_search_x2x.js index 5aa66ed2..d77e740a 100644 --- a/web_advanced_search_x2x/static/src/js/web_advanced_search_x2x.js +++ b/web_advanced_search_x2x/static/src/js/web_advanced_search_x2x.js @@ -53,6 +53,10 @@ odoo.define('web_advanced_search_x2x.search_filters', function (require) { this._super.apply(this, arguments); if (this.relational) { this.x2x_field().appendTo(this.$el); + this._x2x_field.$el.on( + "autocompleteopen", + this.proxy('x2x_autocomplete_open') + ); } delete this.relational; }, @@ -85,6 +89,7 @@ odoo.define('web_advanced_search_x2x.search_filters', function (require) { name: this.field.name, options: JSON.stringify({ no_create: true, + no_open: true, model: this.field.relation, }), }, @@ -111,6 +116,18 @@ odoo.define('web_advanced_search_x2x.search_filters', function (require) { return "char_domain"; } }, + x2x_autocomplete_open: function() + { + var widget = this._x2x_field.$input.autocomplete("widget"); + widget.on('click', 'li', function(e) + { + widget.trigger( + 'menuselect', + {item: jQuery(e.currentTarget)} + ); + e.stopPropagation(); + }); + }, get_domain: function () { // Special way to get domain if user chose "domain" filter if (this.get_operator() == "domain") { @@ -227,10 +244,10 @@ odoo.define('web_advanced_search_x2x.search_filters', function (require) { _.each(compound_domains, function(domain) { combined.add(domain.eval()); - }) + }); _.each(leaves, function(leaf) { - combined.add([leaf]) + combined.add([leaf]); }); result.domains[index] = combined; } diff --git a/web_advanced_search_x2x/views/templates.xml b/web_advanced_search_x2x/views/templates.xml index 5c978273..4dee899f 100644 --- a/web_advanced_search_x2x/views/templates.xml +++ b/web_advanced_search_x2x/views/templates.xml @@ -5,7 +5,7 @@