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] stock_picking_batch_validate_confirm: avoid propagating context with defaults #1870

Merged
merged 1 commit into from
Feb 12, 2025

Conversation

yajo
Copy link
Member

@yajo yajo commented Feb 10, 2025

When this module was installed along with sale_elaboration, elaboration sale order lines could be created automatically when confirming a picking.

The sale.order.line model also has a move_ids field. Thus, those lines were created associated to the stock.move records found from within the batch.

To make it even more fun, a batch can contain moves associated to unrelated sales. Thus, the elaboration lines were getting stock moves (which is wrong because they are services) and those moves came from unrelated sale orders.

This mismatch was resulting in unexpected behaviors here and there.

Now, we just produce defaults based on the standard context that all wizards get by default. This is safe and doesn't pollute any sub-calls.

@moduon MT-9033 MT-7490

@OCA-git-bot
Copy link
Contributor

Hi @rafaelbn, @EmilioPascual,
some modules you are maintaining are being modified, check this out!

… with defaults

When this module was installed along with `sale_elaboration`, elaboration sale order lines could be created automatically when confirming a picking.

The `sale.order.line` model also has a `move_ids` field. Thus, those lines were created associated to the `stock.move` records found from within the batch.

To make it even more fun, a batch can contain moves associated to unrelated sales. Thus, the elaboration lines were getting stock moves (which is wrong because they are services) and those moves came from unrelated sale orders.

This mismatch was resulting in unexpected behaviors here and there.

Now, we just produce defaults based on the standard context that all wizards get by default. This is safe and doesn't pollute any sub-calls.

@moduon MT-9033 MT-7490
@yajo yajo force-pushed the 16.0-spbvc-fix_elaboration_compat branch from 95c532a to 2a687be Compare February 10, 2025 13:29
@rafaelbn rafaelbn added this to the 16.0 milestone Feb 10, 2025
Copy link
Contributor

@Shide Shide left a comment

Choose a reason for hiding this comment

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

Code LGTM

Copy link
Contributor

@EmilioPascual EmilioPascual left a comment

Choose a reason for hiding this comment

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

LGTM. Code review

@EmilioPascual
Copy link
Contributor

/ocabot merge patch

@OCA-git-bot
Copy link
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 16.0-ocabot-merge-pr-1870-by-EmilioPascual-bump-patch, awaiting test results.

@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at aca7f45. Thanks a lot for contributing to OCA. ❤️

@OCA-git-bot OCA-git-bot merged commit 51acdad into OCA:16.0 Feb 12, 2025
11 of 12 checks passed
@yajo yajo deleted the 16.0-spbvc-fix_elaboration_compat branch February 12, 2025 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants