[5016][UPD] mrp_subcontracting_skip_no_negative#169
Draft
Conversation
yostashiro
reviewed
Dec 6, 2024
Member
yostashiro
left a comment
There was a problem hiding this comment.
@kanda999 It wasn't clear to me whether negative stock would really be created before this update. Can you please confirm on this point?
yostashiro
reviewed
Dec 10, 2024
Member
yostashiro
left a comment
There was a problem hiding this comment.
Does this handle the following scenario well?
Process a receipt picking with the following content:
- Subcontracted product: demand x2, done x1
- Normal product: demand x2, done x1
Generated backorder picking:
- Subcontracted product: demand x1
- Normal product: demand x1
Looking at the code, I suppose it works in this manner. Please confirm.
If it works OK, please add comments explaining the design rationale.
yostashiro
reviewed
Dec 10, 2024
Comment on lines
+72
to
+73
| moves_with_check = self - moves_with_no_check | ||
| res = super(StockMove, moves_with_check.with_context(no_backorder=True))._action_done( |
Member
There was a problem hiding this comment.
I guess the current code doesn't handle the case well where partial receipt is processed for a picking which only contains subcontracted products.
Suggested change
| moves_with_check = self - moves_with_no_check | |
| res = super(StockMove, moves_with_check.with_context(no_backorder=True))._action_done( | |
| # Assign `no_backorder=True` context to the first batch of moves for _action_done() | |
| # to avoid generation of a backorder during the process, in case there are two batches | |
| # of moves (with negative check and without) to be processed in _action_done(). | |
| if moves_with_no_check != self: | |
| moves_with_no_check = moves_with_no_check.with_context(no_backorder=True) | |
| res = super(StockMove, moves_with_no_check)._action_done( | |
| cancel_backorder=cancel_backorder | |
| ) | |
| res += super(StockMove, self - moves_with_no_check)._action_done( | |
| cancel_backorder=cancel_backorder | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
5016
Reflect OCA updates