Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0012100Openbravo ERP07. Sales managementpublic2010-02-02 17:382010-03-10 18:29
networkb 
dbaz 
highminoralways
closedfixed 
5
2.50MP11 
2.50MP142.50MP12 
Core
No
0012100: Firefox doesn't add numbers correctly in Sales Management
We have to cofigure Firefox:
  -about:config
  -dom.disable_window_status_change: false

We need a sale invoice with amount: 1000 or more.

We have to cofigure Firefox:
  -about:config
  -dom.disable_window_status_change: false

-As Openbravo Admin go to Sales Management || Transactions || Sales Invoice
-In the Grid mode select 3 sales (One of them > 1000)
-Put the cursor over 'Grand Total Amount'.
-Realize that on the lower left corner appears a wrong number
On Purchase Management the behaviour is correct.
No tags attached.
related to defect 0008177 closed shuehner Calculations done by XmlEngine (i.e. sum) are done using double. which leads to calculation errors. 
related to backport 0012222 closed dbaz Firefox doesn't add numbers correctly in Sales Management 
Issue History
2010-02-02 17:38networkbNew Issue
2010-02-02 17:38networkbAssigned To => rafaroda
2010-02-02 21:21shuehnerNote Added: 0023914
2010-02-02 21:22shuehnerRelationship addedrelated to 0008177
2010-02-02 21:23shuehnerNote Added: 0023915
2010-02-02 21:23shuehnerIssue Monitored: shuehner
2010-02-03 10:53networkbTarget Version2.50MP14 => 2.50MP13
2010-02-03 11:18rafarodaNote Added: 0023924
2010-02-03 11:18rafarodaAssigned Torafaroda => dbaz
2010-02-04 15:47hgbotCheckin
2010-02-04 15:47hgbotNote Added: 0023959
2010-02-04 15:47hgbotStatusnew => resolved
2010-02-04 15:47hgbotResolutionopen => fixed
2010-02-04 15:47hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/2d7d6845bd6dd20dd955cdf4a9dc679ec08e7a99 [^]
2010-02-10 22:24dbazRelationship addedrelated to 0012222
2010-02-15 17:36hudsonbotCheckin
2010-02-15 17:36hudsonbotNote Added: 0024292
2010-02-17 12:43shuehnerNote Added: 0024485
2010-02-17 12:43shuehnerStatusresolved => closed
2010-02-17 12:43shuehnerFixed in Version => 2.50MP12
2010-02-18 00:00anonymoussf_bug_id0 =>
2010-03-08 16:06jpabloaeTarget Version2.50MP13 => 2.50MP14
2010-03-10 18:29anonymoussf_bug_id => 2968003

Notes
(0023914)
shuehner   
2010-02-02 21:21   
I tested the behavior a bit:

Depending on the numbers which are added the result is not correct (but showing some 0.00000001 error or similar at the end.

Checking the code shows two code-paths:
a.)
If the selected rows are all in the datagrid's buffer (already loaded), then the calculation is done on the client side in javascript using the normal js-floating point arithmetic (which is not exact! )
b.)
if not all selected rows are in the datagrid's buffer an ajax-request to the server is made, and the backend calculates the columns' total in the database.

The case b.) should be always correct, however code-path a.) cannot be correct in general due to the usage of floating point arithmetic.
(0023915)
shuehner   
2010-02-02 21:23   
Added relation to 8177, as its the same issue which was already fixed in xmlEngine.

Note that the same fix cannot be directly applied to the js parts, as afaik js only has floating point arithmetic.

One possible solution would be to always use the ajax-backend request to calculate the total. However this would add one request per use of that feature in all cases, even if all data is already present in the clients' buffer.
(0023924)
rafaroda   
2010-02-03 11:18   
Re-assigned to David, waiting for Scheduling.
(0023959)
hgbot   
2010-02-04 15:47   
Repository: erp/devel/pi
Changeset: 2d7d6845bd6dd20dd955cdf4a9dc679ec08e7a99
Author: David Baz Fayos <david.baz <at> openbravo.com>
Date: Thu Feb 04 15:44:50 2010 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/2d7d6845bd6dd20dd955cdf4a9dc679ec08e7a99 [^]

Fixed issue 12100: Now DataGrid numeric column sum works properly

---
M src/org/openbravo/erpCommon/security/Login_F1.html
M web/js/dojotoolkit/dojo/dojo.js
M web/js/dojotoolkit/dojo/dojo.js.uncompressed.js
M web/js/openbravo/widget/DataGrid.js
M web/js/utils.js
---
(0024292)
hudsonbot   
2010-02-15 17:36   
A changeset related to this issue has been promoted to main after passing a series of tests and an OBX has been generated:

Changeset: http://code.openbravo.com/erp/devel/main/rev/2d7d6845bd6d [^]
Merge Changeset: http://code.openbravo.com/erp/devel/main/rev/2596487a564c [^]
Tests: http://builds.openbravo.com/view/devel-int/ [^]
OBX: http://builds.openbravo.com/erp/core/obx/OpenbravoERP-2.50CI.16391.obx [^]
(0024485)
shuehner   
2010-02-17 12:43   
Tested in pi/postgres. Can't reproduce problem anymore, closing as fixed.