[FIX] stock, mrp: Fix precision overflow in forecasted report

- Fix tends to prevent precision overflow in forecasted report

Current behavior before PR:
- If there are 2 units in stock and product_uom_qty is set to 0.66 the free_stock will be equal to 1.3399999999999999

Desired behavior after PR is merged:
- If there are 2 units in stock and product_uom_qty is set to 0.66 the free_stock should be equal to 1.34

opw-2425473
opw-2459650
opw-2448443
opw-2446985
opw-2440853
opw-2464507

closes odoo/odoo#70321

X-original-commit: c69fb8ec6828676a1900c56f1e87df809b6b70c2
Signed-off-by: Rémy Voet <ryv-odoo@users.noreply.github.com>
This commit is contained in:
nouraellm
2021-05-05 15:14:38 +00:00
committed by Rémy Voet (ryv)
parent 9a01a2953f
commit 43d539dc5a
@@ -4,7 +4,7 @@
from collections import defaultdict
from odoo import api, models
from odoo.tools import float_is_zero, format_datetime, format_date
from odoo.tools import float_is_zero, format_date, float_round
class ReplenishmentReport(models.AbstractModel):
@@ -127,7 +127,7 @@ class ReplenishmentReport(models.AbstractModel):
'receipt_date': format_date(self.env, move_in.date) if move_in else False,
'delivery_date': format_date(self.env, move_out.date) if move_out else False,
'is_late': is_late,
'quantity': quantity,
'quantity': float_round(quantity, precision_rounding=product.uom_id.rounding),
'move_out': move_out,
'move_in': move_in,
'reservation': reservation,