Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0028747Openbravo ERPA. Platformpublic2015-01-23 12:092015-02-11 08:36
normalminorhave not tried
Production - Confirmed Stable
3.0PR14Q2 [^]
0028747: If a numeric value is entered using a formula, it is saved without being rounded
When a user enters a number manually, it is rounded before being stored (i.e. if the user enters 1.2345 and the number format is configured to show only 2 decimals the stored number will be 1.23).

The problem is that if the user enters a formula in a numeric field, the stored value is not rounded.
- Open the Sales Order window
- Create a new header
- Create a new line. Select any product. Set the Ordered Quantity to 1000 and save.
- Change the Unit price to 0.33 and save. Check that the Line Net Amount is 330.00 (OK)
- Change the Unit price to 0.33333333 and save. Check that the Line Net Amount is 330.00 (OK)
- Change the Unit price to =1/3 and save. Check that the Line Net Amount is 333.33 (WRONG)
No tags attached.
caused by defect 00255173.0PR14Q3 closed shankarb Wrong calculations on numeric field depending on the formula 
related to defect 00284273.0PR15Q2 closed AugustoMauch Price is not rounded to calculate the line net amount in Create Lines process of Purchase Order 
related to defect 0028765 acknowledged platform It is not possible to use formula inputs if ',' is used as decimal separator 
Issue History
2015-01-23 12:09AugustoMauchNew Issue
2015-01-23 12:09AugustoMauchAssigned To => AugustoMauch
2015-01-23 12:09AugustoMauchModules => Core
2015-01-23 12:09AugustoMauchTriggers an Emergency Pack => No
2015-01-23 12:11AugustoMauchRegression level => Production - Confirmed Stable
2015-01-23 12:11AugustoMauchRegression date => 2014-03-05
2015-01-23 12:11AugustoMauchRegression introduced in release => 3.0PR14Q2
2015-01-23 12:11AugustoMauchRegression introduced by commit => [^]
2015-01-23 14:21AugustoMauchRelationship addedcaused by 0025517
2015-01-26 12:41AugustoMauchRelationship addedrelated to 0028427
2015-01-26 12:42AugustoMauchIssue Monitored: alostale
2015-01-26 12:42AugustoMauchReview Assigned To => alostale
2015-01-26 12:42hgbotCheckin
2015-01-26 12:42hgbotNote Added: 0073770
2015-01-26 12:42hgbotStatusnew => resolved
2015-01-26 12:42hgbotResolutionopen => fixed
2015-01-26 12:42hgbotFixed in SCM revision => [^]
2015-01-26 12:47AugustoMauchRelationship addedrelated to 0028765
2015-01-26 15:29AugustoMauchSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=7537#r7537
2015-01-29 17:42alostaleNote Added: 0073911
2015-01-29 17:42alostaleStatusresolved => new
2015-01-29 17:42alostaleResolutionfixed => open
2015-01-29 17:54alostaleNote Edited: 0073911bug_revision_view_page.php?bugnote_id=0073911#r7559
2015-01-29 23:18hgbotCheckin
2015-01-29 23:18hgbotNote Added: 0073923
2015-01-29 23:18hgbotStatusnew => resolved
2015-01-29 23:18hgbotResolutionopen => fixed
2015-01-29 23:18hgbotFixed in SCM revision [^] => [^]
2015-01-30 09:41alostaleNote Added: 0073930
2015-01-30 09:41alostaleStatusresolved => closed
2015-01-30 09:41alostaleFixed in Version => 3.0PR15Q2
2015-02-04 20:34hudsonbotCheckin
2015-02-04 20:34hudsonbotNote Added: 0074180
2015-02-04 20:34hudsonbotCheckin
2015-02-04 20:34hudsonbotNote Added: 0074200
2015-02-11 08:36alostaleNote Added: 0074345
2015-02-11 08:36alostaleNote Edited: 0074345bug_revision_view_page.php?bugnote_id=0074345#r7659

2015-01-26 12:42   
Repository: erp/devel/pi
Changeset: 39b9171de017afa00b4331275c111d66251c4cb4
Author: Augusto Mauch <augusto.mauch <at>>
Date: Mon Jan 26 12:39:25 2015 +0100
URL: [^]

Fixes bug 28747,related with bug 28427: Number entered with formula is rounded

The problem was that if a number was entered using a formula (i.e. by entering =1/3 in the form item), the value was not rounded using the numeric field mask. For non-formula inputs the validation is done at the beginning of the blur function. For formula inputs it is not possible to do it at that point, because the value of the field is still the formula, not the result of evaluating the formula. The formula is evaluated in the validate function(), so the rounding for formula inputs is done after invoking it.

M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-number.js
2015-01-29 17:42   
(edited on: 2015-01-29 17:54)

-Create line
-price: =1/3
-line net amount 330 (ok)
-line net amount changed to 333.33

2015-01-29 23:18   
Repository: erp/devel/pi
Changeset: 79617a539b534107622ee34fdf7b43e9b5329b15
Author: Augusto Mauch <augusto.mauch <at>>
Date: Thu Jan 29 23:14:48 2015 +0100
URL: [^]

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.

M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-number.js
2015-01-30 09:41   
code reviewed

tested in:
*standard window: as described in the issue
*Parameter window grid: using formulas in Purchase Order > Create Lines process grid
*Parameter window parameter: using formulas in Sales Invoice > Add Payment process parameters
2015-02-04 20:34   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: [^]
Maturity status: Test
2015-02-04 20:34   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: [^]
Maturity status: Test
2015-02-11 08:36   
added test to TestLink: [^]