Fixes issue 0017846: Multicurrency - finacc_txn_convert_rate numeric field in the DB is showing more than 6 characters
authorAdrián Romero <adrianromero@openbravo.com>
Thu, 21 Jul 2011 15:35:12 +0200
changeset 13247 a89603e59074
parent 13246 b67d11a30224
child 13248 56151e1a260f
Fixes issue 0017846: Multicurrency - finacc_txn_convert_rate numeric field in the DB is showing more than 6 characters
It has been formatted-parsed the data that comes from callout to fix the number of decimals according the field properties
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js	Wed Jul 20 18:41:24 2011 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js	Thu Jul 21 15:35:12 2011 +0200
@@ -759,6 +759,7 @@
   },
   
   processColumnValue: function(columnName, columnValue, editValues){
+  	// Modifications in this method should go also in setColumnValuesInEditValues because both almost do the same
     var isDate, i, valueMap = {}, oldValue, field = this.getFieldFromColumnName(columnName), entries = columnValue.entries;
     // not a field on the form, probably a datasource field
     var prop = this.view.getPropertyFromDBColumnName(columnName);
@@ -868,6 +869,7 @@
   },
   
   setColumnValuesInEditValues: function(columnName, columnValue, editValues){
+  	// Modifications in this method should go also in processColumnValue because both almost do the same
     // no editvalues even anymore, go away
     if (!editValues) {
       return;
@@ -889,7 +891,7 @@
       }
       editValues[prop + '._valueMap'] = valueMap;
     }
-    
+
     if (columnValue.value && (columnValue.value === 'null' || columnValue.value === '')) {
       // handle the case that the FIC returns a null value as a string
       // should be repaired in the FIC
@@ -921,11 +923,17 @@
       editValues[prop] = null;
     }
     
+
+
     // store the textualvalue so that it is correctly send back to the server
     if (field) {
+      // Adjust to formatting if exists value and classicValue.
+      var assignClassicValue = (field.typeInstance && field.typeInstance.parseInput && field.typeInstance.editFormatter)
+        ? field.typeInstance.editFormatter(field.typeInstance.parseInput(columnValue.classicValue))
+        : columnValue.classicValue;
       var typeInstance = SimpleType.getType(field.type);
       if (columnValue.classicValue && typeInstance.decSeparator) {
-        this.setTextualValue(field.name, columnValue.classicValue, typeInstance, editValues);
+        this.setTextualValue(field.name, assignClassicValue, typeInstance, editValues);
       }
     }
   },