Browse Source

inhibit closing the menu when selecting from the dropdown

pull/1197/head
Holger Brunn 7 years ago
committed by Pedro M. Baeza
parent
commit
cb646ba74e
  1. 21
      web_advanced_search/static/src/js/web_advanced_search_x2x.js
  2. 2
      web_advanced_search/views/templates.xml

21
web_advanced_search/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;
}

2
web_advanced_search/views/templates.xml

@ -5,7 +5,7 @@
<template id="assets_backend" name="web_advanced_search_x2x assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/web_advanced_search_x2x/static/src/js/web_advanced_search_x2x.js"></script>
<script type="text/javascript" src="/web_advanced_search_x2x/static/src/js/web_advanced_search_x2x.js"/>
</xpath>
</template>

Loading…
Cancel
Save