-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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: keep end time and duration consistent when moving work order #97805
[FIX] mrp: keep end time and duration consistent when moving work order #97805
Conversation
db42299
to
a365330
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I correctly understood the discussion you had with William, this looks ok. But I prefer to let him check (@Whenrow )
Also, I think this worth adding a test
5fd2434
to
8cc5c11
Compare
8cc5c11
to
e2b26d9
Compare
addons/mrp/models/mrp_workorder.py
Outdated
@@ -349,6 +355,16 @@ def write(self, values): | |||
end_date = fields.Datetime.to_datetime(values.get('date_planned_finished')) or workorder.date_planned_finished | |||
if start_date and end_date and start_date > end_date: | |||
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._compute_date_planned_finished(start_date) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you rename the method. It can be confusing with actual compute methods
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done ! Changed 'compute' to 'calculate'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @Whenrow, are you okay with this PR now ?
When drag and dropping a work order in the Work Orders Planning, the end time wasn't recomputed. This can make the end time inconsistent with the duration when the work order spans across a non-working time. Steps to reproduce: 1. Install Manufacturing 2. Go to Settings > Manufacturing > Operations and enable Work Orders 3. Go to Manufacturing > Master Data > Routings and edit routing 'Primary Assembly' to last 120:00 minutes 4. Go to Manufacturing > Operations > Manufacturing Orders and create one with values: - Product: Table Top - Plan From: today's date at 11:00:00 5. Save, mark as todo and plan the manufacturing order 6. Go to Manufacturing > Planning > Planning by Workcenter and trigger the day view 7. Move the work order to 8 am 8. The work order still lasts for 3 hours (according to its start and finish time) even though its expected duration is 2 hours Solution: Recompute `date_planned_finished` when we move a work order in the planning (`date_planned_start` and `date_planned_finished` are passed in values), and recompute `expected_duration` when we extend it (only one of them is passed depending on the way we extend the work order). (`duration_expected` is never passed in values when we manipulate a work order through the planning) Problem: `date_planned_finished` wasn't recomputed when moving the work order in the planning opw-2893622
e2b26d9
to
562058b
Compare
robodoo r+ |
When drag and dropping a work order in the Work Orders Planning, the end time wasn't recomputed. This can make the end time inconsistent with the duration when the work order spans across a non-working time. Steps to reproduce: 1. Install Manufacturing 2. Go to Settings > Manufacturing > Operations and enable Work Orders 3. Go to Manufacturing > Master Data > Routings and edit routing 'Primary Assembly' to last 120:00 minutes 4. Go to Manufacturing > Operations > Manufacturing Orders and create one with values: - Product: Table Top - Plan From: today's date at 11:00:00 5. Save, mark as todo and plan the manufacturing order 6. Go to Manufacturing > Planning > Planning by Workcenter and trigger the day view 7. Move the work order to 8 am 8. The work order still lasts for 3 hours (according to its start and finish time) even though its expected duration is 2 hours Solution: Recompute `date_planned_finished` when we move a work order in the planning (`date_planned_start` and `date_planned_finished` are passed in values), and recompute `expected_duration` when we extend it (only one of them is passed depending on the way we extend the work order). (`duration_expected` is never passed in values when we manipulate a work order through the planning) Problem: `date_planned_finished` wasn't recomputed when moving the work order in the planning opw-2893622 closes #97805 Signed-off-by: William Henrotin (whe) <whe@odoo.com>
@MerlinGuillaume @Whenrow this pull request has forward-port PRs awaiting action (not merged or closed): |
This PR odoo#97805 wrongly assumed that self contained a single workorder. This would raise an error if there were multiple records in self. Solution: Modify calls on `self` to `workorder` (as we already iterate through them)
This PR odoo#97805 wrongly assumed that self contained a single workorder. This would raise an error if there were multiple records in self. Solution: Modify calls on `self` to `workorder` (as we already iterate through them) X-original-commit: 26cb902
This PR odoo#97805 wrongly assumed that self contained a single workorder. This would raise an error if there were multiple records in self. Solution: Modify calls on `self` to `workorder` (as we already iterate through them) X-original-commit: 26cb902
This PR odoo#97805 wrongly assumed that self contained a single workorder. This would raise an error if there were multiple records in self. Solution: Modify calls on `self` to `workorder` (as we already iterate through them) X-original-commit: 26cb902
This PR odoo#97805 wrongly assumed that self contained a single workorder. This would raise an error if there were multiple records in self. Solution: Modify calls on `self` to `workorder` (as we already iterate through them) X-original-commit: 26cb902
This PR odoo#97805 wrongly assumed that self contained a single workorder. This would raise an error if there were multiple records in self. Solution: Modify calls on `self` to `workorder` (as we already iterate through them) X-original-commit: 26cb902
This PR #97805 wrongly assumed that self contained a single workorder. This would raise an error if there were multiple records in self. Solution: Modify calls on `self` to `workorder` (as we already iterate through them) closes #101750 X-original-commit: 26cb902 Signed-off-by: William Henrotin (whe) <whe@odoo.com> Signed-off-by: Guillaume Merlin (megu) <megu@odoo.com>
This PR #97805 wrongly assumed that self contained a single workorder. This would raise an error if there were multiple records in self. Solution: Modify calls on `self` to `workorder` (as we already iterate through them) closes #101775 X-original-commit: 26cb902 Signed-off-by: William Henrotin (whe) <whe@odoo.com> Signed-off-by: Guillaume Merlin (megu) <megu@odoo.com>
This PR #97805 wrongly assumed that self contained a single workorder. This would raise an error if there were multiple records in self. Solution: Modify calls on `self` to `workorder` (as we already iterate through them) closes #101742 X-original-commit: 26cb902 Signed-off-by: William Henrotin (whe) <whe@odoo.com> Signed-off-by: Guillaume Merlin (megu) <megu@odoo.com>
This PR #97805 wrongly assumed that self contained a single workorder. This would raise an error if there were multiple records in self. Solution: Modify calls on `self` to `workorder` (as we already iterate through them) closes #101728 X-original-commit: 26cb902 Signed-off-by: William Henrotin (whe) <whe@odoo.com> Signed-off-by: Guillaume Merlin (megu) <megu@odoo.com>
This PR #97805 wrongly assumed that self contained a single workorder. This would raise an error if there were multiple records in self. Solution: Modify calls on `self` to `workorder` (as we already iterate through them) closes #101761 X-original-commit: 26cb902 Signed-off-by: William Henrotin (whe) <whe@odoo.com> Signed-off-by: Guillaume Merlin (megu) <megu@odoo.com>
When drag and dropping a work order in the Work Orders Planning, the end time wasn't recomputed. This can make the end time inconsistent with the duration when the work order spans across a non-working time. Steps to reproduce: 1. Install Manufacturing 2. Go to Settings > Manufacturing > Operations and enable Work Orders 3. Go to Manufacturing > Master Data > Routings and edit routing 'Primary Assembly' to last 120:00 minutes 4. Go to Manufacturing > Operations > Manufacturing Orders and create one with values: - Product: Table Top - Plan From: today's date at 11:00:00 5. Save, mark as todo and plan the manufacturing order 6. Go to Manufacturing > Planning > Planning by Workcenter and trigger the day view 7. Move the work order to 8 am 8. The work order still lasts for 3 hours (according to its start and finish time) even though its expected duration is 2 hours Solution: Recompute `date_planned_finished` when we move a work order in the planning (`date_planned_start` and `date_planned_finished` are passed in values), and recompute `expected_duration` when we extend it (only one of them is passed depending on the way we extend the work order). (`duration_expected` is never passed in values when we manipulate a work order through the planning) Problem: `date_planned_finished` wasn't recomputed when moving the work order in the planning opw-2893622 closes odoo/odoo#97805 Signed-off-by: William Henrotin (whe) <whe@odoo.com>
This PR odoo/odoo#97805 wrongly assumed that self contained a single workorder. This would raise an error if there were multiple records in self. Solution: Modify calls on `self` to `workorder` (as we already iterate through them) closes odoo/odoo#101580 Signed-off-by: William Henrotin (whe) <whe@odoo.com>
When drag and dropping a work order in the Work Orders Planning, the end time wasn't recomputed. This can make the end time inconsistent with the duration when the work order spans across a non-working time. Steps to reproduce: 1. Install Manufacturing 2. Go to Settings > Manufacturing > Operations and enable Work Orders 3. Go to Manufacturing > Master Data > Routings and edit routing 'Primary Assembly' to last 120:00 minutes 4. Go to Manufacturing > Operations > Manufacturing Orders and create one with values: - Product: Table Top - Plan From: today's date at 11:00:00 5. Save, mark as todo and plan the manufacturing order 6. Go to Manufacturing > Planning > Planning by Workcenter and trigger the day view 7. Move the work order to 8 am 8. The work order still lasts for 3 hours (according to its start and finish time) even though its expected duration is 2 hours Solution: Recompute `date_planned_finished` when we move a work order in the planning (`date_planned_start` and `date_planned_finished` are passed in values), and recompute `expected_duration` when we extend it (only one of them is passed depending on the way we extend the work order). (`duration_expected` is never passed in values when we manipulate a work order through the planning) Problem: `date_planned_finished` wasn't recomputed when moving the work order in the planning opw-2893622 closes odoo/odoo#97805 Signed-off-by: William Henrotin (whe) <whe@odoo.com>
This PR odoo/odoo#97805 wrongly assumed that self contained a single workorder. This would raise an error if there were multiple records in self. Solution: Modify calls on `self` to `workorder` (as we already iterate through them) closes odoo/odoo#101580 Signed-off-by: William Henrotin (whe) <whe@odoo.com>
When drag and dropping a work order in the Work Orders Planning, the
end time wasn't recomputed. This can make the end time inconsistent with
the duration when the work order spans across a non-working time.
Steps to reproduce:
'Primary Assembly' to last 120:00 minutes
one with values:
the day view
finish time) even though its expected duration is 2 hours
Solution:
Recompute
date_planned_finished
when we move a work order in theplanning (
date_planned_start
anddate_planned_finished
are passed invalues), and recompute
expected_duration
when we extend it (only oneof them is passed depending on the way we extend the work order).
(
duration_expected
is never passed in values when we manipulate a workorder through the planning)
Problem:
date_planned_finished
wasn't recomputed when moving the work order inthe planning
opw-2893622