From 161b3ec7027104dda4ddc27dfe1c0bf685b1e48d Mon Sep 17 00:00:00 2001 From: William Henrotin Date: Tue, 4 Aug 2020 15:03:37 +0000 Subject: [PATCH] [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 --- addons/mrp/models/mrp_workorder.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/mrp/models/mrp_workorder.py b/addons/mrp/models/mrp_workorder.py index 5ffb7ffc860..7d53543534b 100644 --- a/addons/mrp/models/mrp_workorder.py +++ b/addons/mrp/models/mrp_workorder.py @@ -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)