This is a very dangerous fix (res.currency is a core system object), and inappropriate given the way OpenERP uses floats rather than decimals.
Our floating point calculations are all performed with floats, and we have appropriate solutions for all cases based on floats. So for consistency, please do not introduce the use of Decimal in patches. For more info on the everlasting Float vs. Decimal discussion, see [1].
Here the problem is the equality comparison in account_voucher. For checking that 2 amounts are equal with regard to an appropriate precision, the 2 amounts should be subtracted and checked with res.currency.is_zero().
You can see other examples of how this is done in other places in the code, for example [2].
This is a very dangerous fix (res.currency is a core system object), and inappropriate given the way OpenERP uses floats rather than decimals.
Our floating point calculations are all performed with floats, and we have appropriate solutions for all cases based on floats. So for consistency, please do not introduce the use of Decimal in patches. For more info on the everlasting Float vs. Decimal discussion, see [1].
Here the problem is the equality comparison in account_voucher. For checking that 2 amounts are equal with regard to an appropriate precision, the 2 amounts should be subtracted and checked with res.currency. is_zero( ).
You can see other examples of how this is done in other places in the code, for example [2].
Thanks!
[1] https:/ /lists. launchpad. net/openerp- expert- accounting/ msg00067. html bazaar. launchpad. net/~openerp/ openobject- addons/ trunk/view/ 5493/account_ voucher/ account_ voucher. py#L940
[2] http://