details:   https://code.openbravo.com/erp/devel/pi/rev/af39974bd6a5
changeset: 33424:af39974bd6a5
user:      Carlos Aristu <carlos.aristu <at> openbravo.com>
date:      Tue Feb 13 08:43:38 2018 +0100
summary:   fixes bug 37872: Error when directly open a child record whose tab 
has filters

 When direct opening a child record whose tab already has a filter applied 
(because of a previously created saved view) a JS error was being thrown in the 
loadFilterAuxiliaryCache function. This was caused because the form of the 
filter editor was not present yet. To prevent this error, we are now checking 
whether that form exists before continue with the execution of the 
loadFilterAuxiliaryCache function.

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
 |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (32 lines):

diff -r 83ecad689e9e -r af39974bd6a5 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
     Mon Feb 12 12:38:32 2018 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
     Tue Feb 13 08:43:38 2018 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2010-2017 Openbravo SLU
+ * All portions are Copyright (C) 2010-2018 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -1215,7 +1215,7 @@
   // loads the foreign key filter auxiliary cache of all the filter fields 
that were using the 'id' filter type when the view was saved
   loadFilterAuxiliaryCache: function (filterAuxCache) {
     var i, cacheElement, filterField;
-    if (!filterAuxCache || !isc.isA.Array(filterAuxCache) || 
filterAuxCache.length === 0) {
+    if (!this.canLoadFilterAuxiliaryCache(filterAuxCache)) {
       return;
     }
     for (i = 0; i < filterAuxCache.length; i++) {
@@ -1228,6 +1228,10 @@
     }
   },
 
+  canLoadFilterAuxiliaryCache: function (filterAuxCache) {
+    return filterAuxCache && isc.isA.Array(filterAuxCache) && 
filterAuxCache.length > 0 && this.filterEditor && 
this.filterEditor.getEditForm();
+  },
+
   // overridden to also store the group mode
   // http://forums.smartclient.com/showthread.php?p=93877#post93877
   getGroupState: function () {

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to