Fixes issue 28379: Value from field is not lost after setting it with a process
authorAugusto Mauch <>
Wed, 24 Dec 2014 11:11:43 +0100
changeset 25596 2cf47120feef
parent 25595 adafc2c0f504
child 25597 ba63fb1101d3
Fixes issue 28379: Value from field is not lost after setting it with a process

This issue was caused from a bug in the OBViewGrid.processFICReturn function. There was some code that meant to save in the grid the value of fields that were not being shown in the grid, and that therefore were not returned by the datasource when the grid was loaded. The faulty condition to check if the value of the field was present in the grid was the following:

if (field && !this.getRecord(rowNum)[]) {

This condition is not proper because it does not check if the field is visible in the grid or not. This condition will evaluate to true if the value of that field is null, even if the field is being shown in the grid. Due to this when the value of the Storage Bin field was erased, its new null value was stored in the list of edited values of the grid, and this value took precedence over the Storage Bin value picked in the process.

To fix this, the condition has been improved to check if the field is actually being shown in the grid.
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js	Wed Dec 24 14:36:24 2014 +0530
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js	Wed Dec 24 11:11:43 2014 +0100
@@ -3952,13 +3952,20 @@
         field = this.getFieldFromColumnName(prop);
         // This call to the FIC was done to retrieve the missing values
         // Do not try to overwrite the existing values
-        if (field && !this.getRecord(rowNum)[]) {
+        if (field && !this.fieldIsVisible( && !this.getRecord(rowNum)[]) {
           grid.processColumnValue(rowNum, prop, columnValues[prop]);
+  fieldIsVisible: function (fieldName) {
+    // this.getFields returns the list of fields that are currently visible in the grid, 
+    // as opposed to this.completeFields that contains the whole list of fields that can be shown in the grid  
+    var visibleFields = this.getFields();
+    return visibleFields.containsProperty('name', fieldName);
+  },
   updateRecord: function (recordIndex, data, req) {
     var sessionProperties = this.view.getContextInfo(true, true, false, true),
         me = this;