# HG changeset patch
# User Miguel de Juana <miguel.dejuana@openbravo.com>
# Date 1465807346 -7200
#      Mon Jun 13 10:42:26 2016 +0200
# Node ID 8b796775b440d4caccc9a19add14f5e823db220d
# Parent  fe389a3ec022ce5565b86afd48de6813513abb19
Fixed issue 0033215: Autofilter provided by component OB.UI.SearchInputAutoFilter is not working fine.

- Disable autofiltering base on preference defined in the component

diff --git a/web/org.openbravo.mobile.core/source/component/ob-commonbuttons.js b/web/org.openbravo.mobile.core/source/component/ob-commonbuttons.js
--- a/web/org.openbravo.mobile.core/source/component/ob-commonbuttons.js
+++ b/web/org.openbravo.mobile.core/source/component/ob-commonbuttons.js
@@ -710,7 +710,7 @@
   input: function () {
     // for remote data sources do not do automatic search when pressing keys, wait for the user
     // to press enter
-    if ((this.name === 'productFilterText' && !OB.MobileApp.model.hasPermission('OBPOS_remote.product', true)) || (this.name === 'customerFilterText' && !OB.MobileApp.model.hasPermission('OBPOS_remote.customer', true))) {
+    if (!OB.MobileApp.model.hasPermission(this.skipAutoFilterPref, true)) {
       var temp = this.getValue(),
           me = this;
       if (temp.length >= this.minLengthToSearch || this.minLengthToSearch === 0) {
diff --git a/web/org.openbravo.mobile.core/source/retail/component/ob-retail-searchproductcharacteristic.js b/web/org.openbravo.mobile.core/source/retail/component/ob-retail-searchproductcharacteristic.js
--- a/web/org.openbravo.mobile.core/source/retail/component/ob-retail-searchproductcharacteristic.js
+++ b/web/org.openbravo.mobile.core/source/retail/component/ob-retail-searchproductcharacteristic.js
@@ -217,7 +217,8 @@
           kind: 'OB.UI.SearchInputAutoFilter',
           name: 'productFilterText',
           style: 'width: 100%;',
-          minLengthToSearch: 2
+          minLengthToSearch: 2,
+          skipAutoFilterPref: 'OBPOS_remote.product'
         }]
       }, {
         style: 'display: table-cell;',
