odoo/odoo#197499

Created by Training, Louis Gobert (loug)
Merged at 202f77e5333318412da86e097a625cdc20344797

Statuses:

label
odoo-dev:17.0-stock_account-fix-svl-rounding-loug
head
f7643ed2c0c508fe4fb866a04fac7a375f07ec2d
merged
8 months ago by Bugfix, Adrien Widart (awt)
odoo/odoo
17.0 #197499
saas-17.4 #197543
18.0 #197549
saas-18.1 #197552
saas-18.2
saas-18.3
saas-18.4
19.0
master #197554

[FIX] stock_account: resolve SVL rounding issue

Problem with stock valuation rounding.

Steps to reproduce:
- Create a product with automated valuation in AVCO
- Set the product cost to 16.83
- Update the quantity to 10
- Make a purchase order with this product: quantity 10 and unit price 20
- Receive the product
- On the product, reduce the quantity to: 10 (-10), then 1 (-9), then 0 (-1)
- Check the valuation, it will remain -0.05 with a quantity of 0

This commit improves the previous commit:
795ce67 by using float_compare to check if the rounding error should be considered a rounding issue.

opw-4387534