Skip to content
Snippets Groups Projects
Commit 0edeed2f authored by MerlinGuillaume's avatar MerlinGuillaume
Browse files

[FIX] mrp: change date_planned_finished when starting workorder


The scheduled end date of a work order is not consistent with its
scheduled start date when starting the work order

Steps to reproduce:
1. Install Manufacturing
2. Go to Settings > Manufacturing > Operations and enable Work Orders
3. Create a manufacturing order for any product, with any component and
   a work order
4. Confirm and plan the MO
5. Edit the scheduled start date of the work order to the next working
   day and save
6. Start the work order
7. The scheduled start date changes but the scheduled end date doesn't

Solution:
When starting a work order, change the `date_planned_finished` according
to the new `date_planned_start`

opw-3005767

closes odoo/odoo#102809

Related: odoo/enterprise#32619
Signed-off-by: default avatarWilliam Henrotin (whe) <whe@odoo.com>
parent adbf4dc2
No related branches found
No related tags found
No related merge requests found
......@@ -593,6 +593,8 @@ class MrpWorkorder(models.Model):
else:
if self.date_planned_start > start_date:
vals['date_planned_start'] = start_date
if self.duration_expected:
vals['date_planned_finished'] = self._calculate_date_planned_finished(start_date)
if self.date_planned_finished and self.date_planned_finished < start_date:
vals['date_planned_finished'] = start_date
return self.with_context(bypass_duration_calculation=True).write(vals)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment