Related with bug 25811: Dont refresh the subtabs always after refreshing form
authorAugusto Mauch <augusto.mauch@openbravo.com>
Mon, 17 Nov 2014 21:39:13 +0100
changeset 25282 e670de099d88
parent 25281 64e842ab60fe
child 25283 7ca429601aca
Related with bug 25811: Dont refresh the subtabs always after refreshing form

Not always when the OBViewForm.refresh function should its children tabs be refreshed. Sometimes they should be refreshed (i.e. when pressing the refresh toolbar button of after a process is executed), but other times they should not (i.e. when the form is refreshed because a record has been saved in one of its sutabs).
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js	Mon Nov 17 14:56:47 2014 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js	Mon Nov 17 21:39:13 2014 +0100
@@ -955,7 +955,7 @@
     }
   },
 
-  refresh: function (callback) {
+  refresh: function (callback, refreshChildren) {
     var criteria = {
       id: this.getValue(OB.Constants.ID)
     },
@@ -967,7 +967,12 @@
         index = me.view.viewGrid.getRecordIndex(me.view.viewGrid.getSelectedRecord());
         if (index !== -1) {
           me.view.viewGrid.updateRecord(index, data, dsRequest);
-          me.view.refreshChildViews();
+          if (refreshChildren) {
+            // only refresh the children when needed.
+            // i.e. when a sub tab is saved the form view of its parent tab is refreshed,
+            // but then there is no need to refresh the sub tab
+            me.view.refreshChildViews();
+          }
         }
       }
       if (callback && isc.isA.Function(callback)) {
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js	Mon Nov 17 14:56:47 2014 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js	Mon Nov 17 21:39:13 2014 +0100
@@ -192,8 +192,10 @@
 
   REFRESH_BUTTON_PROPERTIES: {
     action: function () {
+      var refreshChildren = true;
       if (this.view.isShowingForm) {
-        this.view.viewForm.refresh();
+        // Refresh the form and its children records
+        this.view.viewForm.refresh(refreshChildren);
       } else {
         this.view.refresh();
       }