[FIX] base: support float rounding with rounding_method=UP (ceiling)
authorMartin Trigaux <mat@openerp.com>
Wed, 8 Oct 2014 14:10:52 +0000 (16:10 +0200)
committerOlivier Dony <odo@openerp.com>
Wed, 22 Oct 2014 12:28:22 +0000 (14:28 +0200)
commit7705f883d23b71cdb1d30300ce69d9df665ae55e
tree7c867319ce47a3effca041e1dbf41eee0b0f6276
parent354b82bee050ed29dd96adad613cac79ca778104
[FIX] base: support float rounding with rounding_method=UP (ceiling)

Add rounding_method parameter on float_round method to offer
HALF-UP (default, usual round) or UP (ceiling) rounding method.
Use the second method instead of math.ceil() for product
reservations.

For UP, the python math.ceil() method uses "torwards infinity"
rounding method while we want "away from zero".
Therefore we use the absolute value of normalized_value to make
sure than -1.8 is rounded to -2.0 and not -1.

Fixes #1125 #2793

This is a cherry-pick of d4972ff which was reverted at 333852e due
to remaining issue with negative values.
addons/product/_common.py
openerp/addons/base/test/base_test.yml
openerp/tools/float_utils.py