Skip to content
Snippets Groups Projects
Commit 3d48e2b4 authored by Nicolas Martinelli's avatar Nicolas Martinelli
Browse files

[FIX] sale_stock: package with decimal values


Follow-up of f1e79c74

The issue still arises with:
8 % 1.6 = 1.5999999999999996

The modulo operator on float doesn't seem reliable for our use case,
therefore we use a combination of `float_round` and `float_compare` to
verify the quantity sold is a multiple of the quantity per package.

The rounding threshold is 0.01, meaning that the warning might not be
raised for some specific configurations. For example, 8.005 units with
a package of 1.6 won't return a warning. Since this is a non-blocking
warning, this should be enough for most cases.

opw-2241985

closes odoo/odoo#49923

Signed-off-by: default avatarNicolas Martinelli (nim) <nim@odoo.com>
parent 51cfd1cf
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment