Fixes issue
28727: valueMap is properly initialized in pick and execute windows
The problem was that when a line in a pick and execute grid was edited, the valueMap of its OBFKComboItems was not properly initialized. The initialization is done in the OBPickAndExecuteGrid.processColumnValue function.
Before the Openbravo combos was refactored, the columnValue parameter used to contain the full valueMap of the combo in its entries attribute. This atribute was passed to the OBPickAndExecuteGrid.setValueMap, and the valueMap of the combos was initialized. The problem was that since the combos was refactored the columnValue parameter no longer contained the entries attribute, because the FIC now only returns the selected value. To fix this, in this case the valueMap is built manually based on the column value and identifier. This valueMap is passed to the OBPickAndExecuteGrid.setValueMap function to initialize the field valueMap.
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-pick-and-execute-grid.js Mon Mar 16 16:42:25 2015 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-pick-and-execute-grid.js Mon Mar 16 16:57:41 2015 +0100
@@ -692,17 +692,22 @@
},
processColumnValue: function (rowNum, columnName, columnValue) {
- var field;
+ var field, valueMap = [];
if (!columnValue) {
return;
}
-
+ field = this.getFieldByColumnName(columnName);
+ if (!field) {
+ return;
+ }
if (columnValue.entries) {
- field = this.getFieldByColumnName(columnName);
- if (!field) {
- return;
- }
this.setValueMap(field.name, columnValue.entries);
+ } else if (field.fkField && columnValue.value && columnValue.identifier) {
+ valueMap[0] = {
+ id: columnValue.value,
+ identifier: columnValue.identifier
+ };
+ this.setValueMap(field.name, valueMap);
}
},