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

[5016][UPD] mrp_subcontracting_skip_no_negative #169

Open
wants to merge 2 commits into
base: 16.0
Choose a base branch
from

Conversation

kanda999
Copy link
Contributor

@kanda999 kanda999 commented Dec 6, 2024

5016
Reflect OCA updates

Copy link
Member

@yostashiro yostashiro left a 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?

Copy link
Member

@yostashiro yostashiro left a 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.

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(
Copy link
Member

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.

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
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants