Fixes issue 28747: Numeric field textual value is also rounded
authorAugusto Mauch <augusto.mauch@openbravo.com>
Thu, 29 Jan 2015 23:14:48 +0100
changeset 24123 d6b21dfcf62c
parent 24122 e18688c19880
child 24124 a9b62c65a205
Fixes issue 28747: Numeric field textual value is also rounded

The problem was that even though the value of the field was being properly rounded, its textual value - sent as the propertyName_textualValue - was being kept unrounded. To fix it, now when the value of a numeric field is entered using a formula both its numeric and its textual value are updated.
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-number.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-number.js	Mon Jan 26 12:39:25 2015 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-number.js	Thu Jan 29 23:14:48 2015 +0100
@@ -469,6 +469,10 @@
       if (isFormula) {
         // the formula is evaluated in the validate function, so until then it is not possible to round it, do it now
         value = this.roundJsNumberUsingTypeInstance(value, this.typeInstance);
+        if (this.form.setTextualValue) {
+          textRoundedValue = OB.Utilities.Number.JSToOBMasked(value, this.typeInstance.maskNumeric, this.typeInstance.decSeparator, this.typeInstance.groupSeparator, OB.Format.defaultGroupingSize);
+          this.form.setTextualValue(this.name, textRoundedValue, this.typeInstance);
+        }
         this.setValue(value);
       }
       // first check if the number is valid