[IMP] Insert completed facet in stead of the index used for the completion, instead...
authorXavier Morel <xmo@openerp.com>
Wed, 9 May 2012 15:12:17 +0000 (17:12 +0200)
committerXavier Morel <xmo@openerp.com>
Wed, 9 May 2012 15:12:17 +0000 (17:12 +0200)
bzr revid: xmo@openerp.com-20120509151217-4juo2hm8xxj21uj9

addons/web/static/src/js/search.js

index 198740f..7c35a79 100644 (file)
@@ -500,7 +500,10 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea
     select_completion: function (e, ui) {
         e.preventDefault();
 
-        this.query.add(ui.item.facet);
+        var input_index = _(this.input_subviews).indexOf(
+            this.subviewForRoot(
+                this.$element.find('div.oe_searchview_input:focus')[0]));
+        this.query.add(ui.item.facet, {at: input_index / 2});
     },
     renderFacets: function () {
         var self = this;