Prevent implicit filtering when a target record is passed in
authorMartin Taal <martin.taal@openbravo.com>
Wed, 26 Jan 2011 12:48:40 +0100
changeset 10140 7eb5aee711a2
parent 10139 21e24d50ff52
child 10141 27b5cc218e46
Prevent implicit filtering when a target record is passed in
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js	Wed Jan 26 12:26:29 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js	Wed Jan 26 12:48:40 2011 +0100
@@ -928,6 +928,7 @@
     if (!tabInfos) {
       return;
     }
+    
     for (i = 0; i < tabInfos.length; i++) {
       if (tabInfos[i].targetTabId === this.tabId) {
         // found it..., check if a record needs to be edited
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js	Wed Jan 26 12:26:29 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js	Wed Jan 26 12:48:40 2011 +0100
@@ -513,19 +513,20 @@
   },
   
   convertCriteria: function(criteria){
+    var selectedValues;
+
     criteria = criteria || {};
+
+    if (this.targetRecordId) {
+      // do not filter on anything with a targetrecord
+      criteria = {};
+      // remove the filter clause we don't want to use
+      this.filterClause = null;
+      criteria._targetRecordId = this.targetRecordId;
+    }
     
     criteria = OB.Utilities._getTabInfoRequestProperties(this.view, criteria);
     
-    var isFiltering = criteria.length > 0;
-    var filterValues = [];
-    var index = 0, selectedValues;
-    var fkFieldsLength = this.foreignKeyFieldNames.getLength(), filterValue = null;
-    
-    if (this.targetRecordId) {
-      criteria._targetRecordId = this.targetRecordId;
-    }
-    
     // note pass in criteria otherwise infinite looping!
     this.resetEmptyMessage(criteria);
     
@@ -540,16 +541,6 @@
       }
     }
     
-    // now repair the filtering on foreign keys to use the identifier
-    //    for (index = 0; index < fkFieldsLength; index++) {
-    //      if (criteria[this.foreignKeyFieldNames[index]]) {
-    //        filterValue = criteria[this.foreignKeyFieldNames[index]];
-    //        delete criteria[this.foreignKeyFieldNames[index]];
-    //        criteria[this.foreignKeyFieldNames[index] + '.' +
-    //        OB.Constants.IDENTIFIER] = filterValue;
-    //      }
-    //    }
-    
     // prevent the count operation
     criteria[isc.OBViewGrid.NO_COUNT_PARAMETER] = 'true';