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: prevent byproduct missing record error #92728

Closed

Conversation

kado-odoo
Copy link
Contributor

@kado-odoo kado-odoo commented Jun 2, 2022

Before this commit, there was a bug with MO by-product moves:

 - With a newly created MO, confirm MO and after manually add `Produced` 
   quantity in By-Products and change quantity producing in MO and  save the
   record then it raises the missing record error.

same issues was fixed here c1768d0
but forgot to fix same in write method.
so this commit is fix same but in write method

TaskID - 2799848
PR - #92728

@robodoo
Copy link
Contributor

robodoo commented Jun 2, 2022

Pull request status dashboard

@C3POdoo C3POdoo requested a review from a team June 2, 2022 06:52
@C3POdoo C3POdoo added the RD research & development, internal work label Jun 2, 2022
@kado-odoo kado-odoo marked this pull request as draft June 2, 2022 10:02
@kado-odoo kado-odoo force-pushed the 15.0-mrp-by-products-user-error-fix-kado branch from 328743e to 5fb3826 Compare June 13, 2022 13:04
@kado-odoo kado-odoo changed the title [FIX] mrp: by products user error [FIX] mrp: prevent missing error in mrp Jun 13, 2022
@kado-odoo kado-odoo force-pushed the 15.0-mrp-by-products-user-error-fix-kado branch 2 times, most recently from f02d44f to 12a62be Compare June 13, 2022 13:11
@kado-odoo kado-odoo marked this pull request as ready for review June 14, 2022 09:02
Copy link
Contributor

@ticodoo ticodoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix seems fine except for my one comment and ideally you should add a test as well since byproducts don't have many tests and they seem to be quite buggy.

Also your commit message should be improved:

  • There is no need to write what code change did since it is already in your code change.
  • It would be better to say your fix is a modified version of the similar bugfix: c1768d0
  • You don't really explain why the issue was occurring so its hard to understand your solution (see the similar bugfix for its explanation of why the issue is occurring)
  • It should be "missing record error" instead of "missing error"
  • rename your commit to something more specific and remove 2nd reference to mrp since its already there: [FIX] mrp: prevent byproduct missing record error

Comment on lines 728 to 729
if 'move_byproduct_ids' in vals and 'move_finished_ids' not in vals:
vals['move_finished_ids'] = vals.get('move_finished_ids', []) + vals['move_byproduct_ids']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If condition looks for 'move_finished_ids' not in vals, then won't vals.get('move_finished_ids', []) always be []?

@kado-odoo kado-odoo force-pushed the 15.0-mrp-by-products-user-error-fix-kado branch 2 times, most recently from 4a0792a to 561484c Compare June 27, 2022 09:23
@kado-odoo kado-odoo changed the title [FIX] mrp: prevent missing error in mrp [FIX] mrp: prevent byproduct missing record error Jun 27, 2022
@kado-odoo
Copy link
Contributor Author

@ticodoo
Changes are done.
can you please check?

@ticodoo
Copy link
Contributor

ticodoo commented Jun 27, 2022

Hello, I believe you can combine your new test with test_00_mrp_byproduct by adding the steps to reproduce after self.assertTrue(moves, 'No moves are created !')

Also:

  • please squash your commits into 1 commit.
  • When following the exact steps to reproduce from your commit message, it doesn't throw the error. I think you are missing the MO confirm step + a save after changing the byproduct qty produced before changing the MO qty produced.
  • The reason why the issue occurs isn't explained in your commit. The bug in the previous bugfix is different from this one so it has a different cause even though the solution is similar. Ideally you would include the reason for this issue in this commit so people can understand the fix in the future and so they can avoid repeating the issue in the future.

Before this commit, there was a bug with MO by-product moves:

     - With a newly created MO, confirm MO and after manually add `Produced`
       quantity in By-Products and change quantity producing in MO and  save the
       record then it raises the missing record error.

same issues was fixed here odoo@c1768d0
but forgot to fix same in write method.
so this commit is fix same but in write method

TaskID - 2799848
@kado-odoo kado-odoo force-pushed the 15.0-mrp-by-products-user-error-fix-kado branch from 561484c to 41f4b0c Compare June 28, 2022 10:11
@kado-odoo
Copy link
Contributor Author

@ticodoo
Changes are done.
can you please check?

@ticodoo
Copy link
Contributor

ticodoo commented Jun 28, 2022

LGTM, thanks for your work!

@robodoo r+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RD research & development, internal work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants