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][IMP] stock_restrict_lot: validate lot moved is correct #1443

Merged
merged 1 commit into from
Dec 7, 2023

Conversation

aleuffre
Copy link
Contributor

@aleuffre aleuffre commented Nov 29, 2023

Adds a check on picking's validation that the lot indicated in the move line is actually the one in the restriction.

TODO:

  • Tests

@OCA-git-bot
Copy link
Contributor

Hi @florian-dacosta,
some modules you are maintaining are being modified, check this out!

@aleuffre aleuffre changed the title [IMP] stock_restrict_lot: validate lot moved is correct [14.0][IMP] stock_restrict_lot: validate lot moved is correct Nov 29, 2023
@aleuffre aleuffre mentioned this pull request Nov 29, 2023
2 tasks
@aleuffre aleuffre force-pushed the 14.0-stock_restrict_lot_check branch from 2ce3838 to a215e49 Compare December 1, 2023 13:44
@francesco-ooops
Copy link
Contributor

@florian-dacosta should be ready for review now

Copy link

@geomer198 geomer198 left a comment

Choose a reason for hiding this comment

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

Please fix the code by my comments.

stock_restrict_lot/models/stock_move.py Outdated Show resolved Hide resolved
stock_restrict_lot/models/stock_move.py Outdated Show resolved Hide resolved
stock_restrict_lot/tests/test_restrict_lot.py Show resolved Hide resolved
@aleuffre aleuffre force-pushed the 14.0-stock_restrict_lot_check branch from a215e49 to fac88e2 Compare December 4, 2023 08:41
@aleuffre
Copy link
Contributor Author

aleuffre commented Dec 4, 2023

Please fix the code by my comments.

Thank you for your review @geomer198 , I've addressed all your comments

@aleuffre aleuffre force-pushed the 14.0-stock_restrict_lot_check branch from fac88e2 to bbbe514 Compare December 4, 2023 09:12
Copy link

@geomer198 geomer198 left a comment

Choose a reason for hiding this comment

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

LGTM!

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@francesco-ooops
Copy link
Contributor

@florian-dacosta looks good to you? :)

Copy link
Contributor

@florian-dacosta florian-dacosta left a comment

Choose a reason for hiding this comment

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

LGTM
But which is the case where we could an inconsistency between the lot of the stock.move.line and the stock.move?

Is it manual mistak choosing the wrong lot in the UI? In that case, I guess it could also be solved by adding a domain on the stock.move.line lot_id depending on the restrict_lot_id of the stock.move.

Another possibility, to block the user before the validation, would be to replace the action_done override by an api.constrains method to check the lot.

Anyway, ok for me the way it is.

@aleuffre
Copy link
Contributor Author

aleuffre commented Dec 6, 2023

LGTM But which is the case where we could an inconsistency between the lot of the stock.move.line and the stock.move?

Is it manual mistak choosing the wrong lot in the UI? In that case, I guess it could also be solved by adding a domain on the stock.move.line lot_id depending on the restrict_lot_id of the stock.move.

Another possibility, to block the user before the validation, would be to replace the action_done override by an api.constrains method to check the lot.

Anyway, ok for me the way it is.

Thanks for the approval!

I didn't want to add a constraint because stock.move and stock.move.line are not written to at the same time, and there could be times just in the normal functioning of the stock module where the fields are not in sync (maybe the move line has been created but the lot has not been selected/reserved yet, etc), so having just a check in ._action_done() seemed safer to me.

@francesco-ooops
Copy link
Contributor

@pedrobaeza go with this?

@francesco-ooops
Copy link
Contributor

or actually also @florian-dacosta can merge :)

@pedrobaeza
Copy link
Member

/ocabot merge patch

@OCA-git-bot
Copy link
Contributor

On my way to merge this fine PR!
Prepared branch 14.0-ocabot-merge-pr-1443-by-pedrobaeza-bump-patch, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 6d619bf into OCA:14.0 Dec 7, 2023
11 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 75be393. 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.

8 participants