Files
odoo_source/addons
Nicolas Lempereur 00ce18f407 [FIX] point_of_sale: rounding down near 0
Before 03025520b rounding applied was eg. for these numbers and UP and
DOWN rounding methods to multiple of 10:

```
Numbers | -8 | -2 |  2 |  8 | 12
DOWN    | -2 | -8 | -2 | -8 | -2
UP      |  8 |  2 |  8 |  2 |  8
```

which is correct for positive numbers but UP and DOWN are inversed for
negatives numbers.

After 03025520b this became:

```
Numbers | -8 | -2 |  2 |  8 | 12
DOWN    |  8 |  2 |  8 | -8 | -2
UP      | -2 | -8 | -2 |  2 |  8
```

which is correct for all cases except for positive numbers that are
before HALF of the precision (eg. number 2) for which UP and DOWN are
inversed.

This is happening because 03025520b uses the sign of the rounded value
=> this does not work for 0 so number 2 is broken (and if fixed number
-2 would be broken).

With this commit, the adjustement of sign is done based on original
number, so we get the equivalent of python equivalent methods:

```
Numbers | -8 | -2 |  2 |  8 | 12
DOWN    |  8 |  2 | -2 | -8 | -2
UP      | -2 | -8 |  8 |  2 |  8
```

opw-2451841

closes odoo/odoo#70923

X-original-commit: 23dd2ea535bea0a57dcac773a81e202135cd2ed6
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-05-17 20:24:26 +00:00
..
2021-04-29 05:34:20 +00:00
2021-04-28 11:11:29 +00:00
2021-03-25 15:01:43 +00:00
2021-03-30 09:27:05 +00:00
2021-05-12 07:25:22 +00:00