Skip to content
Snippets Groups Projects
Commit 9d3a73f6 authored by Nicolas Martinelli's avatar Nicolas Martinelli
Browse files

[FIX] mrp: Time Cycle computation


- Create a workcenter with a capacity of 500 units
- Create a BOM with a routing generating one work order in the WC
  created
- Create 3 MO with the following real durations:
  MO 1: 1000 units produced in 420.95 seconds
  MO 2: 1000 units produced in 120.28 seconds
  MO 3: 1000 units produced in 60 seconds
- Create a MO for 1 unit

The Duration expected is computed as

The Time Cycle is computed as:
  (420.95 + 120.28 + 60) / (1000 + 1000 + 1000) = 0.20041
The Total Expected is computed as:
  0 + 0 + (1.0 * 0.20041) * (100.0 / 100.0) = 0.20041

0.20041 seconds is not realistic based on the previous MO real
durations.

This is because the Time Cycle doesn't take into account the workcenter
capacity. If we can produce 60 units in parallel in 60 seconds, that
doesn't mean we can produce 1 unit in 1 second. Therefore, the Time
Cycle should be multiplied by the WC capacity, which gives a Time Cycle:

   500 * (420.95 + 120.28 + 60) / (3000) = 100.205

Which is much closer to the real duration.

opw-2070759

closes odoo/odoo#37493

Signed-off-by: default avatarNicolas Martinelli (nim) <nim@odoo.com>
parent 12676f56
No related branches found
No related tags found
No related merge requests found
......@@ -87,7 +87,7 @@ class MrpRoutingWorkcenter(models.Model):
limit=operation.time_mode_batch)
count_data = dict((item['operation_id'][0], (item['duration'], item['qty_produced'])) for item in data)
if count_data.get(operation.id) and count_data[operation.id][1]:
operation.time_cycle = count_data[operation.id][0] / count_data[operation.id][1]
operation.time_cycle = (count_data[operation.id][0] / count_data[operation.id][1]) * (operation.workcenter_id.capacity or 1.0)
else:
operation.time_cycle = operation.time_cycle_manual
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment