Skip to content
Snippets Groups Projects
Commit 0429ffaa authored by Nathan Marotte (nama)'s avatar Nathan Marotte (nama)
Browse files

[FIX] mrp : wrong expected duration in WC with capacity


Issue: In work centers with a capacity different than 1, the expected
duration was wrongly computed

Steps to reproduce :
 1) Install Manufacture, enable Work Centers in Settings
 2) Create a Work Center, Capacity = 2
 3) Create a Product, with Manufacture as route
 4) Create a Bill of Material :
   Add any component
   Add a operation line :
     Work Center = created at 2)
     Duration Computation = based on tracked time last 1 WO
 5) Create a Manufacturing Order for the product 3), confirm
 6) Set the real duration to 00:10, mark as done
 7) Check the BoM Structure & Cost of the BoM 4)
 -> Operations is 00:20

Why is that a bug:
 To compute the expected duration, in mrp_workorder.py L691 we already
 take into consideration the capacity of the work center.
 When computing the time_cycle, we must give a time_cycle for 1 product
 made with capacity 1, so we must first normalize the qty_produced fetch
  from the DB to make like if we only produced the quantity once but in
  the same amount of time

Side-Note: This also solves an issue with the Duration Computation based
 on tracked time. The `limit` keyword was applied after the `group by`
 so we effectively grouped all the operation_ids together, summing
 their quantities and then limiting on the different operation_ids

opw-2562983

closes odoo/odoo#75078

Signed-off-by: default avatarArnold Moyaux <amoyaux@users.noreply.github.com>
parent b699c3e2
Branches
Tags
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment