From b742b79aaa6c6040c55d578079142760d2b1989a Mon Sep 17 00:00:00 2001 From: JF Aubert Date: Fri, 22 Dec 2023 11:17:34 +0100 Subject: [PATCH] [FIX] mrp: allow to consume less than expected In Shop Floor, consuming less tracked by lots components than expected gives an 'Invalid Operation: lot/serial number needs to be specified for a tracked product' error. Discarding the dialog to fix the quantities makes the production order disappear from the Shop Floor. This because of the MO Readiness filter: as the move becomes partially available, the reservation state goes to confirmed rather than assigned. closes odoo/odoo#144718 Signed-off-by: William Henrotin (whe) --- addons/mrp/models/stock_move.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/mrp/models/stock_move.py b/addons/mrp/models/stock_move.py index f2e82cfcba6..eb699778efe 100644 --- a/addons/mrp/models/stock_move.py +++ b/addons/mrp/models/stock_move.py @@ -619,6 +619,8 @@ class StockMove(models.Model): res = super()._get_relevant_state_among_moves() if res == 'partially_available'\ and self.raw_material_production_id\ - and all(move.should_consume_qty and float_compare(move.quantity, move.should_consume_qty, precision_rounding=move.product_uom.rounding) >= 0 for move in self): + and all(move.should_consume_qty and float_compare(move.quantity, move.should_consume_qty, precision_rounding=move.product_uom.rounding) >= 0 + or (float_compare(move.quantity, move.product_uom_qty, precision_rounding=move.product_uom.rounding) >= 0 or (move.manual_consumption and move.picked)) + for move in self): res = 'assigned' return res