odoo/addons/point_of_sale/static/src/js
Joren Van Onder 7f260ab517
[FIX] point_of_sale: round product.product price analogous to backend
A rounding issue was resolved in
ee33593351. It however introduced
another issue.

Rounding functions (both round_precision in web.utils and float_round
in openerp.tools) are not perfect due to IEEE floating point
limitations. However both should produce the same output given the
same input. An example: rounding 13.95 to 2 digits yields
13.950000000000001.

The additional rounding introduced in
ee33593351 on price lead to issues in
certain cases. One example occurs when applying a 90% discount on a
product costing 13.95. The POS will do the following:

> 13.950000000000001 * 0.09999999999999998
1.3949999999999998
> round_pr(1.3949999999999998, .01)
1.4000000000000001

whereas the backend will do (as eg. in sale.order.line)

>>> 13.95 * 0.09999999999999998
1.3949999999999996
>>> round(1.3949999999999996, 2)
1.3900000000000001

Causing a difference of 0.01.

The core of the issue is that in the backend 13.95 is rounded
differently. When a Float gets written to the database doesn't just
pass through the regular float_round. It passes through
_symbol_set_float which truncates characters exceeding the precision.

This implements the same approach in the POS.

opw-715506
Closes #16119
2017-03-29 10:45:43 +02:00
..
db.js [FIX] point_of_sale: correctly split workds in product search 2015-06-26 08:51:25 +02:00
devices.js [FIX] point_of_sale: scale debug was not working with an unplugged scale 2015-01-27 10:58:58 +01:00
main.js [IMP] point_of_sale: forgot changes in this file in the previous commit that introduced unit tests 2014-08-05 14:07:58 +02:00
models.js [FIX] point_of_sale: round product.product price analogous to backend 2017-03-29 10:45:43 +02:00
screens.js [FIX] point_of_sale: do not select payment input when hidden 2016-03-09 09:13:44 +01:00
tests.js [IMP] point_of_sale: add a basic UI unit test based on the new 'Tour' module 2014-08-05 14:07:41 +02:00
widget_base.js [FIX] point_of_sale: precision 2015-06-11 08:45:17 +02:00
widget_keyboard.js [FIX] point_of_sale: onscreen keyboard working again 2013-12-16 19:20:59 +01:00
widgets.js [FIX] point_of_sale: adapt to Chrome 50's new handling of cell heights 2016-04-19 08:53:10 +02:00