Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0028427Openbravo ERP03. Procurement managementpublic2014-12-16 18:562015-02-04 20:34
0028427: Price is not rounded to calculate the line net amount in Create Lines process of Purchase Order
Price is not rounded to calculate the line net amount in Create Lines process of Purchase Invoices
As group admin role:
   Create a purchase order header
   Check the price precision of the price list currency is 2
   Check also the Format.xml is configured to show 2 decimals
   Click on Create Lines and set:
      Standard Price: 1.1255
      Quantity: 2000
   Check the price is updated to 1.13 but the Line Net Amount is 1.1255*2000=2251 instead of 1.13*2000=2260
No tags attached.
related to defect 00255173.0PR14Q3 closed shankarb Wrong calculations on numeric field depending on the formula 
related to defect 00230563.0MP21 closed shankarb Ordered Quantiy field of Sales Order is not properly auto filling the grouping separator 
related to defect 0028720 closed alostale System is not saving big numbers properly 
related to defect 0028747 closed AugustoMauch If a numeric value is entered using a formula, it is saved without being rounded 
depends on defect 00238683.0MP24 closed AugustoMauch Numeric fields are internally stored as strings due to regression 
depends on defect 00239753.0MP24 closed AugustoMauch Number handling does not work properly if ',' is used as decimal separator 
depends on defect 00237583.0MP24 closed shankarb Format.xml is not correctly applied to Amount reference in grid view 
related to defect 0028765 acknowledged platform It is not possible to use formula inputs if ',' is used as decimal separator 
related to defect 0031901 closed caristu decimal value can't be changed by trigger/observer after manual edition in form view 
Issue History
2014-12-16 18:56ngarciaNew Issue
2014-12-16 18:56ngarciaAssigned To => AtulOpenbravo
2014-12-16 18:56ngarciaModules => Core
2014-12-16 18:56ngarciaResolution time => 1421535600
2014-12-16 18:56ngarciaTriggers an Emergency Pack => No
2014-12-16 18:56ngarciaIssue Monitored: networkb
2015-01-13 18:57ngarciaTarget Version => 3.0PR15Q2
2015-01-22 00:49reinaldoguerraAssigned ToAtulOpenbravo => reinaldoguerra
2015-01-22 00:49reinaldoguerraStatusnew => scheduled
2015-01-22 16:03ngarciaSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=7517#r7517
2015-01-22 18:24SandrahuguetAssigned Toreinaldoguerra => AugustoMauch
2015-01-23 11:02AugustoMauchRelationship addedrelated to 0025517
2015-01-23 14:22AugustoMauchNote Added: 0073755
2015-01-23 14:49AugustoMauchRelationship addedrelated to 0023056
2015-01-23 14:49AugustoMauchRelationship addeddepends on 0023868
2015-01-23 14:49AugustoMauchRelationship addeddepends on 0023975
2015-01-23 14:49AugustoMauchRelationship addeddepends on 0023758
2015-01-23 15:01hgbotCheckin
2015-01-23 15:01hgbotNote Added: 0073757
2015-01-23 15:01hgbotStatusscheduled => resolved
2015-01-23 15:01hgbotResolutionopen => fixed
2015-01-23 15:01hgbotFixed in SCM revision => [^]
2015-01-23 15:03AugustoMauchNote Added: 0073758
2015-01-23 15:03AugustoMauchIssue Monitored: alostale
2015-01-23 15:04AugustoMauchReview Assigned To => alostale
2015-01-26 08:36alostaleRelationship addedrelated to 0028720
2015-01-26 12:41AugustoMauchRelationship addedrelated to 0028747
2015-01-26 12:42hgbotCheckin
2015-01-26 12:42hgbotNote Added: 0073769
2015-01-26 12:47AugustoMauchRelationship addedrelated to 0028765
2015-01-30 09:44alostaleNote Added: 0073931
2015-01-30 09:44alostaleStatusresolved => closed
2015-01-30 09:44alostaleFixed in Version => 3.0PR15Q2
2015-02-04 20:34hudsonbotCheckin
2015-02-04 20:34hudsonbotNote Added: 0074178
2015-02-04 20:34hudsonbotCheckin
2015-02-04 20:34hudsonbotNote Added: 0074181
2016-01-25 12:51caristuRelationship addedrelated to 0031901

2015-01-23 14:22   
Related issues to test: [^] [^] [^] [^]
2015-01-23 15:01   
Repository: erp/devel/pi
Changeset: 7a0dcbb151a516466e2d5841907d8b9d96647acf
Author: Augusto Mauch <augusto.mauch <at>>
Date: Fri Jan 23 15:00:12 2015 +0100
URL: [^]

Fixes issue 28427: Numbers are always rounded on blur

The blur function of the OBNumberItems only did the rounding when the getValue function of the item returned a string. This worked in most of the cases (i.e. standard grids and forms, d
ue to the edit form of the grid having a setTextualValue function, see [1]), but not in the parameter windows. In those windows, both numeric parameters and numeric columns in grid para
meters did not round the entered numbers before saving them.

To fix this, now the numbers are rounded on blur even if the value entered is already a number. To found the number these two functions are invoked:

  value = OB.Utilities.Number.JSToOBMasked(this.getValue(), this.typeInstance.maskNumeric, this.typeInstance.decSeparator, this.typeInstance.groupSeparator);
  this.setValue(OB.Utilities.Number.OBMaskedToJS(value, this.typeInstance.decSeparator, this.typeInstance.groupSeparator));

The first one converts the number to a string representation of the rounded number. The second one converts the rounded string number to a javascript number.

M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-number.js
2015-01-23 15:03   
All the issues listed in this note [1] have been tested, using both '.' and ',' as decimal separators.

It has also been checked that numeric values in parameter windows are now rounded before being saved by checking the value sent to the action handler. Both numeric parameters and numeric columns of grid parameters have been checked.

[1] [^]
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-30 09:44   
code reviewed

tested while closing 0028747, see notes there
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