[FIX] mrp: WO duration nondeterministic

Usecase to reproduce:
- Set operation time base on last workorder
- Create 2 MO
- On first MO, set 15min as duration
- On second MO, set 10min as duration
- Validate both MO at the same time
- The duraction expected on the operation could be now 10 or 15min

It happens because the search in the compute is only base on date.
And when both MO are validated at the same time, it's not enough

closes odoo/odoo#131307

X-original-commit: cad75ac78b61046352c39d3f3b7717cfbad42c8b
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
This commit is contained in:
Arnold Moyaux
2023-08-09 19:27:18 +02:00
parent 9aced74696
commit 8a055dc797
+1 -1
View File
@@ -75,7 +75,7 @@ class MrpRoutingWorkcenter(models.Model):
('qty_produced', '>', 0),
('state', '=', 'done')],
limit=operation.time_mode_batch,
order="date_finished desc")
order="date_finished desc, id")
# To compute the time_cycle, we can take the total duration of previous operations
# but for the quantity, we will take in consideration the qty_produced like if the capacity was 1.
# So producing 50 in 00:10 with capacity 2, for the time_cycle, we assume it is 25 in 00:10