Rounding error prevents order from being paid

Bug #1266969 reported by Amsterdam LLC
24
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
New
Undecided
Unassigned

Bug Description

I am using Windows Server 2003 with OpenERP 7.0

A rounding error is preventing orders from being marked as 'paid' and leaves them in 'draft' state, further preventing users from being able to close their register sessions.

Here is the example scenario, reproduced on a clean install:

OpenERP 7.0 with Point of Sale Module, United States accounting package and tax rate set to 9.0%

Test product named 'Rounding Error' with price $2.50 and 'Customer Taxes' 9.0%

Expected tax cost should be $2.50 * 0.09 = $0.225 ($0.23)

In Point of Sale module, create a new session and add the 'Rounding Error' item qty 1.
Taxes on screen will calculate at $0.23 and total will be $2.73, the customer is charged correctly and pays exact cash $2.73.

Once you receive and validate the payment, the order total (pos_order_line.price_subtotal_incl) is incorrectly recorded to the database as $2.72 ($2.50 + $0.22).

In the 'Orders' section under 'Point of Sale', there will be the open order which has status set to 'New'.

To fix the records manually in the database:

In pos_order_line table, find the record with price_subtotal_incl = 2.72 and update it to 2.73
In pos_order table, find the record with the corresponding id equal to the record above's pos_order_line.order_id and update the "state" field from "draft" to "paid"

The user can now close the session and the order line will no longer show highlighted blue with status 'New'.

I think the error may be similar to this previously reported bug with the addons/account/account.py compute_all function:
https://bugs.launchpad.net/openobject-addons/+bug/977300

Please let me know if you need any further information, I can provide screenshots as well.

Thank you!

UPDATE:
I've been able to workaround the error by changing the Settings -> Accounting\Invoicing -> "Round per line" to "Round Globally" which increases the tax_compute_precision +=5.

I've also tested the following line of code added to account.py compute_all function:

line 2156: tax_compute_precision += 1

This fixed the rounding error with the $2.50 and $5.50 amount, however now the amount $4.83 was causing a rounding error. Actual tax should be $4.83 * 0.09 = 0.4347 ($0.43). The customer was charged $5.26 correctly however the amount recorded to the database was $5.27.

Leaving the option set to 'Round Globally' resolved the rounding error for that amount as well.

description: updated
description: updated
Revision history for this message
Amsterdam LLC (amsterdamllc) wrote :

This also affects line items with value 5.50, example:

In the same scenario above, create a new product with price $5.50 and Customer Tax 9.0%

Actual tax cost should be $5.50 * .09 = $.0495 ($0.50)

Customer is being charged taxes correctly, however the price_subtotal_incl value is stored as $5.99 instead of $6.00

description: updated
description: updated
description: updated
Revision history for this message
Michael Karrer (michaelkarrer81) wrote :

This also happens still in 6.1 even in the 6.1 OCB Branch of the addons - A solution would be badly needed!

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.