[FIX] mrp: display "Not Ready" when negative qty in stock

Steps to reproduce:
- Create a MO that uses a component without quantity in stock
- Make an outgoing transfer that move some quantity of that component
out of stock and validate it
- Go back to the MO and open the Overview

Issue:
The status will display a '-x Ready', which doesn't make sense.
Now properly checks if there is quantity in stock.

closes odoo/odoo#114536

Related: odoo/enterprise#40930
Related: odoo/upgrade#5210
Signed-off-by: Tiffany Chang (tic) <tic@odoo.com>
This commit is contained in:
clesgow
2023-10-20 14:59:10 +00:00
parent 35691afe0d
commit 38956115b4
+2 -2
View File
@@ -209,10 +209,10 @@ class ReportMoOverview(models.AbstractModel):
record.product_qty * (components_qty_reserved[product_id] + product_id.free_qty) / comp_qty_to_produce,
precision_rounding=record.product_uom_id.rounding, rounding_method='DOWN'
)
if float_is_zero(comp_producible_qty, precision_rounding=record.product_uom_id.rounding):
if float_compare(comp_producible_qty, 0, precision_rounding=record.product_uom_id.rounding) <= 0:
return _("Not Ready")
producible_qty = min(comp_producible_qty, producible_qty)
if float_is_zero(producible_qty, precision_rounding=record.product_uom_id.rounding):
if float_compare(producible_qty, 0, precision_rounding=record.product_uom_id.rounding) <= 0:
return _("Not Ready")
elif float_compare(producible_qty, record.product_qty, precision_rounding=record.product_uom_id.rounding) == -1:
producible_qty = float_repr(producible_qty, self.env['decimal.precision'].precision_get('Product Unit of Measure'))