Fixes issue 25795:Auxiliary inputs are refreshed in parent after saving record
authorAugusto Mauch <augusto.mauch@openbravo.com>
Wed, 12 Mar 2014 23:16:11 +0100
changeset 22693 3af79da74bf4
parent 22692 34ce8b9f26ba
child 22694 e74230fb5c88
Fixes issue 25795:Auxiliary inputs are refreshed in parent after saving record

When a record was updated and its parent record was being shown in the grid view, the auxiliary inputs of the parent tab were not being refreshed.

This has been fixed by calling the FIC in SETSESSION mode in the callback executed after refreshing the parent record.
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js	Wed Mar 12 16:34:45 2014 +0000
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js	Wed Mar 12 23:16:11 2014 +0100
@@ -1745,6 +1745,7 @@
     });
 
     callback = function (resp, data, req) {
+      var sessionProperties = me.getContextInfo(true, true, false, true);
       // this line does not work, but it should:
       //      me.getDataSource().updateCaches(resp, req);
       // therefore do an explicit update of the visual components
@@ -1764,6 +1765,35 @@
         me.viewGrid.selectRecord(me.viewGrid.getRecord(recordIndex));
         me.viewGrid.refreshRow(recordIndex);
         me.viewGrid.redraw();
+        if (!me.isShowingForm) {
+          OB.RemoteCallManager.call('org.openbravo.client.application.window.FormInitializationComponent', sessionProperties, {
+            MODE: 'SETSESSION',
+            TAB_ID: me.tabId,
+            PARENT_ID: me.getParentId(),
+            ROW_ID: me.viewGrid.getSelectedRecord() ? me.viewGrid.getSelectedRecord().id : me.getCurrentValues().id
+          }, function (response, data, request) {
+            var sessionAttributes = data.sessionAttributes,
+                auxInputs = data.auxiliaryInputValues,
+                attachmentExists = data.attachmentExists,
+                prop;
+            if (sessionAttributes) {
+              me.viewForm.sessionAttributes = sessionAttributes;
+            }
+
+            if (auxInputs) {
+              this.auxInputs = {};
+              for (prop in auxInputs) {
+                if (auxInputs.hasOwnProperty(prop)) {
+                  me.viewForm.setValue(prop, auxInputs[prop].value);
+                  me.viewForm.auxInputs[prop] = auxInputs[prop].value;
+                }
+              }
+            }
+            me.viewForm.view.attachmentExists = attachmentExists;
+            //compute and apply tab display logic again after fetching auxilary inputs.
+            me.updateSubtabVisibility();
+          });
+        }
       }