[FIX] mrp: update only sooner scheduled date

Starting a workorder should update the scheduled date only if the production
is started sooner than expected. In this case we want to clear the
calendar for the other production. If the production is started later
than expected, updating the calendar has no effect. We leave the
scheduled date unchanged to keep the information

Task : 2278147
This commit is contained in:
William Henrotin
2020-08-10 09:40:24 +00:00
parent 67e258ef1f
commit 161b3ec702
+2 -1
View File
@@ -545,7 +545,8 @@ class MrpWorkorder(models.Model):
vals['leave_id'] = leave.id
return self.write(vals)
else:
vals['date_planned_start'] = start_date
if self.date_planned_start > start_date:
vals['date_planned_start'] = start_date
if self.date_planned_finished < start_date:
vals['date_planned_finished'] = start_date
return self.write(vals)