Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] mrp: write with multiple workorders in self #101580

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions addons/mrp/models/mrp_workorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,13 +357,13 @@ def write(self, values):
raise UserError(_('The planned end date of the work order cannot be prior to the planned start date, please correct this to save the work order.'))
if 'duration_expected' not in values:
if 'date_planned_start' in values and 'date_planned_finished' in values:
computed_finished_time = self._calculate_date_planned_finished(start_date)
computed_finished_time = workorder._calculate_date_planned_finished(start_date)
values['date_planned_finished'] = computed_finished_time
elif 'date_planned_start' in values:
computed_duration = self._calculate_duration_expected(date_planned_start=start_date)
computed_duration = workorder._calculate_duration_expected(date_planned_start=start_date)
values['duration_expected'] = computed_duration
elif 'date_planned_finished' in values:
computed_duration = self._calculate_duration_expected(date_planned_finished=end_date)
computed_duration = workorder._calculate_duration_expected(date_planned_finished=end_date)
values['duration_expected'] = computed_duration
# Update MO dates if the start date of the first WO or the
# finished date of the last WO is update.
Expand Down