[FIX] mrp: rounding total amounts before splitting

closes odoo/odoo#115467

X-original-commit: e5ff98655a21366d49f44c7b4374f8a04b72cd70
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
This commit is contained in:
Linh Pham
2023-03-16 10:49:00 +01:00
committed by William Henrotin
parent 981290ee9c
commit cd2e8e589d
+3 -3
View File
@@ -1552,11 +1552,11 @@ class MrpProduction(models.Model):
amounts[production] = _default_amounts(production)
continue
total_amount = sum(mo_amounts)
if total_amount < production.product_qty and not cancel_remaining_qty:
diff = float_compare(production.product_qty, total_amount, precision_rounding=production.product_uom_id.rounding)
if diff > 0 and not cancel_remaining_qty:
amounts[production].append(production.product_qty - total_amount)
has_backorder_to_ignore[production] = True
elif float_compare(total_amount, production.product_qty, precision_rounding=production.product_uom_id.rounding) > 0 \
or production.state in ['done', 'cancel']:
elif diff < 0 or production.state in ['done', 'cancel']:
raise UserError(_("Unable to split with more than the quantity to produce."))
backorder_vals_list = []