[FIX] mrp: date_planned_start is empty
This commit fixes the traceback when the user push the start button in the Work Order list View of a work order without a date_planned_start. To recreate the traceback, the order must be based on a manufacturing order with multiple work orders, with at least one with a scheduled start date and one without a scheduled start date. When creating the manufacturing order, it is important to make sure that only the confirm button is pressed. closes odoo/odoo#110587 X-original-commit: c4d16a57e03d2a9183b232344579978b839a9fb9 Signed-off-by: William Henrotin (whe) <whe@odoo.com>
This commit is contained in:
@@ -636,10 +636,9 @@ class MrpWorkorder(models.Model):
|
||||
vals['leave_id'] = leave.id
|
||||
return self.write(vals)
|
||||
else:
|
||||
if self.date_planned_start > start_date:
|
||||
if not self.date_planned_start or 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)
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user