fixed bug 25919, fixed bug 25972
authorAsier Lostalé <asier.lostale@openbravo.com>
Fri, 14 Mar 2014 15:53:10 +0100
changeset 22709 31ec6d0191e3
parent 22708 eb415e9bc94f
child 22710 d8f328c5d332
fixed bug 25919, fixed bug 25972

Preventing double request when in direct navigation to a window with a
default saved view.

This case cause after SC upgrade not to navigate to form view (nor to
show grid) because datasource was in an incorrecte status.
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-window.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-manage-views.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-window.js	Thu Mar 13 19:04:19 2014 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-window.js	Fri Mar 14 15:53:10 2014 +0100
@@ -427,6 +427,10 @@
       }
     }
 
+    if (this.targetTabGrid) {
+      // in direct navigation for refresh contents after applying personalizations if any 
+      this.views[i].viewGrid.refreshContents();
+    }
     // Field level permissions
     if (data && data.tabs) {
 
@@ -1050,9 +1054,11 @@
         if (this.views[i].tabId === this.targetTabId) {
           targetEntity = this.views[i].entity;
           this.views[i].viewGrid.targetRecordId = this.targetRecordId;
+          this.targetTabGrid = this.views[i].viewGrid;
           this.views[i].openDirectTabView(true);
-          this.views[i].viewGrid.refreshContents();
           this.setFocusInView(this.views[i]);
+          // do not refresh yet, data will be fetched after personalization
+          // is applied
           break;
         }
       }
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-manage-views.js	Thu Mar 13 19:04:19 2014 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-manage-views.js	Fri Mar 14 15:53:10 2014 +0100
@@ -170,7 +170,10 @@
         //clear grouping, will be applied later
         view.viewGrid.clearGroupBy();
         view.viewGrid.setViewState(viewTabDefinition.grid);
-        if (!view.viewGrid.lazyFiltering) {
+        if (!view.viewGrid.lazyFiltering && !view.viewGrid.targetRecordId) {
+          // do not refresh contents if:
+          //  -lazy: requires user action to refresh
+          //  -direct navigation: it is done centrally after applying personalizations 
           view.viewGrid.refreshContents();
         }
       }