[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 <amoyaux@users.noreply.github.com>
This commit is contained in:
Rémy Voet (ryv)
2020-08-20 06:57:19 +00:00
parent 400d14a762
commit 4029b84be8
+1 -1
View File
@@ -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: