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: keep end time and duration consistent when moving work order #97805

Conversation

MerlinGuillaume
Copy link
Contributor

@MerlinGuillaume MerlinGuillaume commented Aug 9, 2022

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

@robodoo
Copy link
Contributor

robodoo commented Aug 9, 2022

Pull request status dashboard

@C3POdoo C3POdoo added the OE the report is linked to a support ticket (opw-...) label Aug 9, 2022
@MerlinGuillaume MerlinGuillaume force-pushed the 13.0-opw-289362-workorder_duration_drag_and_drop-megu branch 2 times, most recently from db42299 to a365330 Compare August 10, 2022 07:11
Copy link
Contributor

@adwid adwid left a 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

@MerlinGuillaume MerlinGuillaume force-pushed the 13.0-opw-289362-workorder_duration_drag_and_drop-megu branch 2 times, most recently from 5fd2434 to 8cc5c11 Compare August 18, 2022 08:09
@MerlinGuillaume MerlinGuillaume changed the title [FIX] mrp: keep end time and duration consistant when moving work order [FIX] mrp: keep end time and duration consistent when moving work order Aug 18, 2022
@MerlinGuillaume MerlinGuillaume force-pushed the 13.0-opw-289362-workorder_duration_drag_and_drop-megu branch from 8cc5c11 to e2b26d9 Compare August 18, 2022 08:12
@MerlinGuillaume MerlinGuillaume marked this pull request as ready for review August 18, 2022 09:24
@C3POdoo C3POdoo requested a review from a team August 18, 2022 09:39
@@ -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)
Copy link
Contributor

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

Copy link
Contributor Author

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'

Copy link
Contributor Author

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
@MerlinGuillaume MerlinGuillaume force-pushed the 13.0-opw-289362-workorder_duration_drag_and_drop-megu branch from e2b26d9 to 562058b Compare August 23, 2022 06:44
@Whenrow
Copy link
Contributor

Whenrow commented Sep 19, 2022

robodoo r+

robodoo pushed a commit that referenced this pull request Sep 19, 2022
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>
@robodoo robodoo temporarily deployed to merge September 19, 2022 15:31 Inactive
@robodoo robodoo closed this Sep 19, 2022
MerlinGuillaume added a commit to odoo-dev/odoo that referenced this pull request Sep 29, 2022
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)
robodoo pushed a commit that referenced this pull request Sep 30, 2022
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 #101580

Signed-off-by: William Henrotin (whe) <whe@odoo.com>
fw-bot pushed a commit to odoo-dev/odoo that referenced this pull request Sep 30, 2022
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
fw-bot pushed a commit to odoo-dev/odoo that referenced this pull request Sep 30, 2022
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
fw-bot pushed a commit to odoo-dev/odoo that referenced this pull request Sep 30, 2022
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
fw-bot pushed a commit to odoo-dev/odoo that referenced this pull request Sep 30, 2022
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
fw-bot pushed a commit to odoo-dev/odoo that referenced this pull request Sep 30, 2022
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
robodoo pushed a commit that referenced this pull request Sep 30, 2022
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>
robodoo pushed a commit that referenced this pull request Sep 30, 2022
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>
robodoo pushed a commit that referenced this pull request Sep 30, 2022
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>
robodoo pushed a commit that referenced this pull request Sep 30, 2022
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>
robodoo pushed a commit that referenced this pull request Oct 1, 2022
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>
@fw-bot fw-bot deleted the 13.0-opw-289362-workorder_duration_drag_and_drop-megu branch October 3, 2022 15:46
gamarino pushed a commit to numaes/numa-public-odoo that referenced this pull request Jan 11, 2023
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>
gamarino pushed a commit to numaes/numa-public-odoo that referenced this pull request Jan 11, 2023
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>
zamberjo pushed a commit to aurestic/OpenUpgrade that referenced this pull request Mar 1, 2023
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>
zamberjo pushed a commit to aurestic/OpenUpgrade that referenced this pull request Mar 1, 2023
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OE the report is linked to a support ticket (opw-...)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants