summaryrefslogtreecommitdiff
path: root/odoo/addons/base/tests/test_float.py
AgeCommit message (Collapse)Author
2019-02-13[IMP] tools: float_utils, precision rounding must be positiveJorge Pinna Puissant
Adding a new rule to verify that precision_rounding is positive. Before this commit: when a precision_round was 0 or smaller than 0 the float_utils functions gave as results: * float_is_zero(0.0, precision_rounding=0.0) -> False * float_round(1.25, precision_rounding=0.0) -> 0.0 * float_compare(1.0, 1.0, precision_rounding=0.0) -> 1 These results where at least not correct at worst not logic. Now, the function raises an error when the precision_rounding is not positive
2018-11-29[REF] *: replace deprecated pycompat helpers for builtinsAdrian Torres
This commit replaces calls to pycompat helpers that were intended for python 2 <-> python 3 interoperability for python 3 builtins, as python 2 is no longer officially supported by Odoo. This includes: * calls to imap/izip/ifilter replaced by map/zip/filter * uses of text_type replaced by str * uses of unichr replaced by chr * calls to implements_to_string, implements_iterator removed * string_types and integer_types replaced by str, int respectively * calls to to_native replaced by calls to to_text This is done in preparation to the removal of these deprecated helpers in the following commit.
2018-04-16[MERGE] forward port branch 11.0 up to ad825b673b5Christophe Simonis
2018-04-11[FIX] base: amount_to_text possible differenceNicolas Lempereur
In 79038055 amount_to_text was refactored and improved, but there is a drawback. ie. if we have .29 cents with two decimals, `Twenty-Eight` was displayed because `int(0.29 * 100) == 28` due to floating-point representation. This commit keeps the improvements and fix this issue by using string formatting of float as was done before. opw-1829924 closes #24161
2018-02-01[MERGE] forward port branch 11.0 up to f5e7b866860Christophe Simonis
2018-01-29[FIX] tools: float_round DOWNNicolas Martinelli
The result of the following: ``` float_round(2.5, precision_rounding=0.05, rounding_method='DOWN') ``` is 2.45. Instead, 2.5 is expected. In case of the `DOWN` method, epsilon should be added, not subtracted. In the meantime, we introduce a slight reorganization of the method to make it clearer. opw-805008
2017-12-04[IMP] base: Forbid users from setting currency rate as 0 or lessqdp-odoo
Because it doesn't have any meaning to do so. Also the default value for rate is now set to 1 instead of 0
2017-05-10[FIX] P3: list -> iterable builtins (#16811)xmo-odoo
In Python 3: * various builtins and dict methods were changed to return view/iterable objects rather than lists * and the separate Python 2 view/iterable builtins and methods were removed altogether This is problematic when using these items as list (which the happens repeatedly in Odoo), but more viciously when iterating *multiple times* over them (which also happens, which I've messed up multiple times while writing this, and which is a pain to debug even when you've just created the issue). Convert all code using these to semantics-matching cross-version helper functions to get the LCD behaviour between P2 and P3, and forbid the builtins via lint. issue #8530
2017-04-27[FIX] builtins removed from Python 3xmo-odoo
* Reverse wrapper courtesy of @rco-odoo's original P3 branch * thin compat module stripped down from werkzeug (to augment as needed) issue 8530
2017-04-10[REF] res_currency: res.currency.rate name is now a date instead of a datetimeqdp-odoo
Since we only uses date fields in accounting, it does not have any sense to have a datetime for currency rate: - it is error prone for the users as the timezone they're in will affect the rate (and possibly take yesterday's rate). - it involved the possibility to create several rates per day, which was not fully supported and might give undeterministic results (so we also add a constraint in order to only have one rate per day)
2017-03-03[ADD] tools/float_utils: add float_split() and float_split_str() methods.qdp-odoo
Add utility methods allowing to split floating points numbers and return their unitary and decimal parts.
2016-09-02[REF] openerp: move `openerp` to `odoo`Raphael Collet