c2c-oerpscenario team mailing list archive
-
c2c-oerpscenario team
-
Mailing list archive
-
Message #02319
[Bug 670307] [NEW] res.currency rounding error
Public bug reported:
The round function of res.currency is making some rounding error:
With euro for instance, the rounding factor is 0.01
The rounding function (in version 5 and trunk) is:
round(amount / currency.rounding) * currency.rounding
Let's take an invoice line with qty = 4.35 and price = 5.70
4.35 * 5.70 = 24.795 ~ 24.80€
When rounded with res.currency the result is 24.79€
in python terminal:
>>> a = 4.35*5.7
>>> b = 0.01
>>> a/b
2479.4999999999995
>>> round(a/b)
2479.0
>>> round(a/b)*b
24.789999999999999
This bug is quite problematic since with receive a supplier invoice billed 24.80€ and we compute 24.79€. Legally, we must store in accounting the exact amount!
This could be solved by using Decimal but it would be more costly...
** Affects: openobject-server
Importance: Undecided
Status: New
--
res.currency rounding error
https://bugs.launchpad.net/bugs/670307
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
Status in OpenObject Server: New
Bug description:
The round function of res.currency is making some rounding error:
With euro for instance, the rounding factor is 0.01
The rounding function (in version 5 and trunk) is:
round(amount / currency.rounding) * currency.rounding
Let's take an invoice line with qty = 4.35 and price = 5.70
4.35 * 5.70 = 24.795 ~ 24.80€
When rounded with res.currency the result is 24.79€
in python terminal:
>>> a = 4.35*5.7
>>> b = 0.01
>>> a/b
2479.4999999999995
>>> round(a/b)
2479.0
>>> round(a/b)*b
24.789999999999999
This bug is quite problematic since with receive a supplier invoice billed 24.80€ and we compute 24.79€. Legally, we must store in accounting the exact amount!
This could be solved by using Decimal but it would be more costly...
Follow ups
References