From 38956115b48580ea94b323a4eb7945359f92af63 Mon Sep 17 00:00:00 2001 From: clesgow Date: Fri, 20 Oct 2023 11:23:18 +0200 Subject: [PATCH] [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) --- addons/mrp/report/mrp_report_mo_overview.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/mrp/report/mrp_report_mo_overview.py b/addons/mrp/report/mrp_report_mo_overview.py index d451eeab14b..db09b65cb1a 100644 --- a/addons/mrp/report/mrp_report_mo_overview.py +++ b/addons/mrp/report/mrp_report_mo_overview.py @@ -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'))