-
Notifications
You must be signed in to change notification settings - Fork 2
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
[5016][UPD] mrp_subcontracting_skip_no_negative #169
base: 16.0
Are you sure you want to change the base?
Conversation
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.
@kanda999 It wasn't clear to me whether negative stock would really be created before this update. Can you please confirm on this point?
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.
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.
moves_with_check = self - moves_with_no_check | ||
res = super(StockMove, moves_with_check.with_context(no_backorder=True))._action_done( |
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.
I guess the current code doesn't handle the case well where partial receipt is processed for a picking which only contains subcontracted products.
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 | |
) |
5016
Reflect OCA updates