[FIX] mrp: MO reservation state bug for serial final product

To reproduce:
- Set tracking mode on Table Leg to no tracking and add 100 to inventory
- Create MO for table with quantity more than one and confirm
- Click the "+" button to generate a serial

Current behavior: The reservation state of the MO goes to "available" in
orange, indicating its components are not all assigned.

Expected behavior: The reservation state of the MO stays "available" in
green, indicating the MO has all of its components assigned and is ready
to produce.

closes odoo/odoo#141130

Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
This commit is contained in:
Pieter Claeys (clpi)
2023-11-06 12:32:02 +00:00
parent 988a215339
commit 61db286a91
+1 -1
View File
@@ -578,6 +578,6 @@ class StockMove(models.Model):
res = super()._get_relevant_state_among_moves()
if res == 'partially_available'\
and self.raw_material_production_id\
and all(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 for move in self):
res = 'assigned'
return res