From f175987c4ad103043f2cbcc2a0a29d8f589a4a4b Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Mon, 30 Apr 2018 12:57:09 +0200 Subject: [PATCH] [FIX] don't close advanced search prematurely; display fixes --- web_advanced_search_x2x/__openerp__.py | 1 + .../static/src/css/web_advanced_search_x2x.css | 1 + .../static/src/js/web_advanced_search_x2x.js | 16 ++++++++++++---- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/web_advanced_search_x2x/__openerp__.py b/web_advanced_search_x2x/__openerp__.py index 64494ffe..fe848809 100644 --- a/web_advanced_search_x2x/__openerp__.py +++ b/web_advanced_search_x2x/__openerp__.py @@ -27,6 +27,7 @@ domain popups. "summary": "Use a search widget in advanced search for x2x fields", "depends": [ 'web', + 'web_m2x_options', ], "qweb": [ 'static/src/xml/web_advanced_search_x2x.xml', diff --git a/web_advanced_search_x2x/static/src/css/web_advanced_search_x2x.css b/web_advanced_search_x2x/static/src/css/web_advanced_search_x2x.css index aac562ec..8f67e638 100644 --- a/web_advanced_search_x2x/static/src/css/web_advanced_search_x2x.css +++ b/web_advanced_search_x2x/static/src/css/web_advanced_search_x2x.css @@ -1,5 +1,6 @@ .openerp .searchview_extended_prop_value .oe_form_field_with_button { + display: inline-block; position: relative; } .openerp .oe_searchview_drawer .web_advanced_search_x2x_domain 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 2f38bb26..c6b61371 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 @@ -4,7 +4,7 @@ openerp.web_advanced_search_x2x = function(instance) { - instance.web_advanced_search_x2x.ExtendedSearchPropositionMany2One = + instance.web_advanced_search_x2x.ExtendedSearchPropositionMany2One = instance.web.search.ExtendedSearchProposition.Char.extend( instance.web.form.FieldManagerMixin, { @@ -47,7 +47,9 @@ openerp.web_advanced_search_x2x = function(instance) return { attrs: { name: this.field.name, - options: '{"no_create": true}', + options: + '{"create": false, "create_edit": false, ' + + '"no_open": true}', }, } }, @@ -59,6 +61,7 @@ openerp.web_advanced_search_x2x = function(instance) } this.searchfield = new instance.web.form.FieldMany2One( this, this.create_searchfield_node()); + this.searchfield.view = this; return this.searchfield; }, operator_changed: function(e) @@ -71,6 +74,9 @@ openerp.web_advanced_search_x2x = function(instance) if(this.show_searchfield()) { this.create_searchfield().appendTo(this.$el.empty()); + this.searchfield.$input.autocomplete('widget').on( + 'click', this, function(e) { e.stopPropagation() } + ); } if(this.show_domain_selection()) { @@ -209,8 +215,9 @@ openerp.web_advanced_search_x2x = function(instance) .prop('disabled', self.searchview.build_search_data().domains.length == 0); self.$buttonpane.find(".oe_selectcreatepopup-search-select") .unbind('click') - .click(function() + .click(function(e) { + e.stopPropagation(); self.select_elements(self.selected_ids) .then(function() { @@ -228,10 +235,11 @@ openerp.web_advanced_search_x2x = function(instance) }); }); }, - select_domain: function() + select_domain: function(e) { var self = this, search = this.searchview.build_search_data(); + e.stopPropagation(); instance.web.pyeval.eval_domains_and_contexts({ domains: search.domains, contexts: search.contexts,