From 4029b84be80a923c4c2cc157bf625b9ba06c0dc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Voet=20=28ryv=29?= Date: Thu, 20 Aug 2020 06:29:15 +0000 Subject: [PATCH] [FIX] mrp: keep the default of expected duration Issue: when we created a new operation from the MO form, the default of the expected_duration wasn't take in account and override to 0.0. Fix: in `_get_duration_expected` If there isn't workcenter is set, instead of return False, return the `duration_expected` closes odoo/odoo#56127 Related: odoo/enterprise#12517 Signed-off-by: Arnold Moyaux --- addons/mrp/models/mrp_workorder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp/models/mrp_workorder.py b/addons/mrp/models/mrp_workorder.py index 7e87f300e16..ad6f91f263a 100644 --- a/addons/mrp/models/mrp_workorder.py +++ b/addons/mrp/models/mrp_workorder.py @@ -666,7 +666,7 @@ class MrpWorkorder(models.Model): def _get_duration_expected(self, alternative_workcenter=False, ratio=1): self.ensure_one() if not self.workcenter_id: - return False + return self.duration_expected if not self.operation_id: duration_expected_working = (self.duration_expected - self.workcenter_id.time_start - self.workcenter_id.time_stop) * self.workcenter_id.time_efficiency / 100.0 if duration_expected_working < 0: