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

[14.0][FIX] stock_location_package_restriction for backorder #1797

Merged

Conversation

TDu
Copy link
Member

@TDu TDu commented Jul 17, 2023

Only check the restriction for moves actually being done.

@@ -31,8 +31,9 @@ def _check_location_package_restriction(self):
location_packages = {
g["location_id"][0]: set(g["package_id"]) for g in quants_grouped
}
lines_being_processed = self.move_line_ids.filtered(lambda line: line.qty_done)
Copy link
Contributor

Choose a reason for hiding this comment

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

@TDu Is this working when not using the detailed operations and quantity_done directly on stock.move ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for your review and the answer is no, it is not working...

Copy link
Contributor

Choose a reason for hiding this comment

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

It should also work as there are always move lines. See https://github.com/odoo/odoo/blob/14.0/addons/stock/models/stock_move.py#L358

Copy link
Member Author

Choose a reason for hiding this comment

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

My quick test was changing the unit test to update the quantity done on the stock.move instead of the move line.
And it failed with
A package is mandatory on the location BWH/Stock/TestLocation2. You cannot move the product Wood without a package
Which does not seem related to your question.

Copy link
Contributor

@jbaudoux jbaudoux left a comment

Choose a reason for hiding this comment

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

LGTM

@TDu
Copy link
Member Author

TDu commented Aug 25, 2023

I have added options on the check function that I need from another PR.
No changes in functionality.

@TDu TDu force-pushed the 14-location-pack-restriction-backorder branch from 3047463 to de01825 Compare October 13, 2023 06:48
@TDu
Copy link
Member Author

TDu commented Oct 13, 2023

Rebased

@jbaudoux
Copy link
Contributor

@rousseldenis Good for you ?

@jbaudoux
Copy link
Contributor

/ocabot merge patch

@OCA-git-bot
Copy link
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 14.0-ocabot-merge-pr-1797-by-jbaudoux-bump-patch, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit e1b7419 into OCA:14.0 Oct 13, 2023
4 of 6 checks passed
@OCA-git-bot
Copy link
Contributor

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

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.

4 participants