diff options
| author | Nicolas Martinelli <nim@odoo.com> | 2015-11-03 17:11:45 +0100 |
|---|---|---|
| committer | Nicolas Martinelli <nim@odoo.com> | 2015-11-04 13:14:59 +0100 |
| commit | ea2c80cad018da6390ea9d116733de691907e1e4 (patch) | |
| tree | 0866ca79324f2bd440e472d4cd84d4055a084e00 /addons/web/static/src/js/framework/session_instance.js | |
| parent | 2f35c4071472bca76a827a275bb22099c5e8baaa (diff) | |
[FIX] web: Python-like rounding method
Javascript and Python handle the rounding of -x.5 differently.
In JS, `Math.round(-0.5)` is equal to `-0`.
In Python, `round(-0.5)` is equal to `-1`.
This will lead to inconsistencies between Python and Javascript, but it
can also lead to inconsistencies in the Javascript itself. Indeed, in
the POS, a refund to the client is entered as a negative number. For
example, `4.245` will be rounded to `4.25`, but a refund of `-4.245`
will be rounded to `-4.24`. The payment and the refund are not
consistent.
Sources:
- http://www.ecma-international.org/ecma-262/6.0/index.html#sec-math.round
- https://docs.python.org/2/library/functions.html#round
- https://en.wikipedia.org/wiki/Rounding#Round_half_up
Fixes #9249
opw-653034
Diffstat (limited to 'addons/web/static/src/js/framework/session_instance.js')
0 files changed, 0 insertions, 0 deletions
