Invoice line subtotal rounding issue

Bug #977300 reported by Paulius Sladkevičius @ hbee on 2012-04-09
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Low
OpenERP R&D Addons Team 3
Therp Backports (Deprecated)
Status tracked in Addons-6.1
Addons-6.1
Undecided
Ronald Portier (Therp)

Bug Description

I have faced rounding issue with quantity 2.5 and price 4.83.

[RESULT OBSERVED]
2.5 x 4.83 = 12.07

[RESULT EXPECTED]
2.5 x 4.83 = 12.08

I found that issue came from the account compute_all() method http://bazaar.launchpad.net/~openerp/openobject-addons/trunk/view/head:/account/account.py#L2072. For currency OpenERP use float_round() function to "fix" rounding issue, but here python default round() function used and of course it don't round correctly.

And from here comes, why in the other accounting parts float_round() is not used instead round()?

Here is simple patch.

Ravish(OpenERP) (rmu-openerp) wrote :

Hello Paulius

I have checked your issue in both 6.1 stable and trunk .But for me ,it's working fine
Would you please provide more and sufficient steps to reproduce it.

Thanks!!

Changed in openobject-addons:
status: New → Incomplete

Ravish,

check invoice screenshot and 3rd invoice line with description "test A" and you can see that subtotal is not correct. I have tested this on the v61 stable last revision.

Changed in openobject-addons:
status: Incomplete → New
Ravish(OpenERP) (rmu-openerp) wrote :

Hello,

I have checked further ,But ended with same result.
For your more reference ,I have attached screen-shot.Please have a look.

I have tested with following Revision Number

Server: 4140
client: 2300
Addons: 6734

Thanks!!

Ravish(OpenERP) (rmu-openerp) wrote :
Changed in openobject-addons:
status: New → Incomplete

Ravish,

I have pulled last revisions now and rounding still incorrect, please give me your python version and try on yours: python -c "print round(2.5*4.83,2)", what value you get? Its a bit strange why we get different result with same source.

I'm using rev:
Server: 4141
client: 2300
Addons: 6735

Changed in openobject-addons:
status: Incomplete → New

What I found out more about round and different python versions:
- Python 2.6.5, round(2.5*4.83,2) -> 12.08
- Python 2.7.2, round(2.5*4.83,2) -> 12.07

I found in the docs, that OpenERP support 2.6 and 2.7, so seems problem comes because Python versions act different.

Ravish(OpenERP) (rmu-openerp) wrote :

Hello,

As per different python versions ,I am conforming this issue.

Thanks!!

Changed in openobject-addons:
status: New → Incomplete
status: Incomplete → Confirmed
importance: Undecided → Low
assignee: nobody → OpenERP R&D Addons Team 3 (openerp-dev-addons3)
Ravish(OpenERP) (rmu-openerp) wrote :

Hello,

It has been fixed on lp:~openerp-dev/openobject-addons/trunk-bug-977300-rmu branch with following Revision Number and Revision ID.

Revision Number:6770
Revision ID : <email address hidden>

This will merge soon with trunk

Thanks..!!!

Changed in openobject-addons:
status: Confirmed → Fix Committed
qdp (OpenERP) (qdp) wrote :

fix released in revision 7111

thanks for the contribution,
Quentin

Changed in openobject-addons:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers