Related to issue 30090: displayed value should be set in fk fields
authorCarlos Aristu <carlos.aristu@openbravo.com>
Tue, 16 Jun 2015 18:06:36 +0200
changeset 26999 f50c80f95f7e
parent 26998 9887ec5384c1
child 27000 9f250bdc7db7
Related to issue 30090: displayed value should be set in fk fields

When the default value of a foreign key field in a new record does not exist already in the grid data, the display value can not be recovered in the setEditValue() method.
In order to ensure the display value is updated to reflect the new edit-value for this field, the display value is now explicitly set.
Also, we send null ROW_ID to avoid the edit values be overriden by the FIC response
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-pick-and-execute-grid.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-pick-and-execute-grid.js	Fri Jun 12 12:49:18 2015 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-pick-and-execute-grid.js	Tue Jun 16 18:06:36 2015 +0200
@@ -723,6 +723,11 @@
       this.setValueMapInEditForm(field.name, valueMap);
       if (this.isEditing()) {
         this.setEditValue(this.getEditRow(), field.name, columnValue.value);
+        // see issue https://issues.openbravo.com/view.php?id=30060
+        // explicitly set the display value
+        if (field.displayField) {
+          this.setEditValue(this.getEditRow(), field.displayField, columnValue.identifier);
+        }
       }
     }
   },
@@ -798,7 +803,7 @@
       MODE: (newRecord ? 'NEW' : 'EDIT'),
       PARENT_ID: null,
       TAB_ID: this.viewProperties.tabId,
-      ROW_ID: (!newRow && record ? record[OB.Constants.ID] : null)
+      ROW_ID: null //ROW_ID is null to avoid edited values be overriden by the FIC
     };
 
     OB.RemoteCallManager.call('org.openbravo.client.application.window.FormInitializationComponent', allProperties, requestParams, this.processFICReturn, {