summaryrefslogtreecommitdiff
path: root/addons/mrp/wizard
diff options
context:
space:
mode:
authorWilliam Henrotin <whe@odoo.com>2020-07-27 13:17:46 +0000
committerWilliam Henrotin <whe@odoo.com>2020-08-10 09:40:24 +0000
commit963ad5eada35f22cc074b4becf4e55ac5edad63b (patch)
tree14f24c1eed8ad745be411b87da834a6ed5e60f0e /addons/mrp/wizard
parent68f06c7accbc903981bbaa47fdc8024bb7229f11 (diff)
[FIX] mrp: keep duration ratio
Updating the quantity to produce on a production order will recompute the expected production duration. This can be counter productive on prototyping production when no BoM are given. The default expected batch duration is set to 60 minutes. Setting the actual production time then updating the quantity to produce will naively change the duration to 60 x the new quantity. This commit compute the duration pro rata in case of 'no BoM' production and recompute everything in case of BoM production. Task : 2278147
Diffstat (limited to 'addons/mrp/wizard')
-rw-r--r--addons/mrp/wizard/change_production_qty.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/mrp/wizard/change_production_qty.py b/addons/mrp/wizard/change_production_qty.py
index cd82ca389f6..9170d3eff2d 100644
--- a/addons/mrp/wizard/change_production_qty.py
+++ b/addons/mrp/wizard/change_production_qty.py
@@ -78,7 +78,7 @@ class ChangeProductionQty(models.TransientModel):
for wo in production.workorder_ids:
operation = wo.operation_id
- wo._onchange_expected_duration()
+ wo.duration_expected = wo._get_duration_expected(ratio=new_production_qty / old_production_qty)
quantity = wo.qty_production - wo.qty_produced
if production.product_id.tracking == 'serial':
quantity = 1.0 if not float_is_zero(quantity, precision_digits=precision) else 0.0