-
-
Notifications
You must be signed in to change notification settings - Fork 703
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
[15.0[FIX] product_lot_sequence: Fix sequence incrementation opening detailed operations #1323
[15.0[FIX] product_lot_sequence: Fix sequence incrementation opening detailed operations #1323
Conversation
Hello @kanda999 Thanks for your comment. I agree there is an issue with the actual implementation of the module and the way this view is working. My gut feeling is that it's probably counter intuitive to use sequence objects to handle generation and creation of lots/SN in the newer version, at least for goods that are purchased and where lots/SN are usually provided by the supplier. I see two possible solutions:
First one would be the more logical move, but I tend to think the second looks like the better long term solution although that would of course require an extra hook in Odoo (or overriding search with a context key). @AdriaGForgeFlow @LoisRForgeFlow what do you think? |
This PR has the |
@grindtildeath Thank you very much for this PR. I agree. The second option sounds better for the long term as it's more in line with the standard design. In the meantime, our workaround for our client for now is to use https://github.com/OCA/stock-logistics-workflow/tree/16.0/stock_picking_auto_create_lot together with this module (containing the update of his PR). Not sure there is actually a situation where manual intervention is required in SN generation, when numbering rule is pre-defined (either for the product or globally). Therefore the use of stock_picking_auto_create_lot works well for us to bypass the design incompatibility between this module and the standard SN generation. |
@grindtildeath can you create an issue to follow up w/ #1323 (comment) and link it in the roadmap? Then we can merge I think. |
b2b1c8d
to
ca381bd
Compare
When opening the detailed operations view of a stock move, Odoo is calling stock.production.lot._get_next_serial to set stock.move.next_serial field anytime the product is tracked by serial and the move is assigned. If we use this module with product or global policy, the respective sequence will therefore be called and incremented anytime this view is open, even if the picking is not creating lots (e.g. delivery orders or internal transfers) To avoid incrementing the sequence unnecessarily, we only allow to get the next sequence number the first time this view is opened and if the move has to create new serial numbers. Otherwise, we force the value to be set to stock.move.next_serial field to an empty string if no serial has to be created through this move, or to the next_serial value assigned on the first opening of the view.
ca381bd
to
c886da5
Compare
/ocabot merge patch |
On my way to merge this fine PR! |
Congratulations, your PR was merged at f0b7e97. Thanks a lot for contributing to OCA. ❤️ |
When opening the detailed operations view of a stock move, Odoo is calling stock.production.lot._get_next_serial to set stock.move.next_serial field anytime the product is tracked by serial and the move is assigned.
If we use this module with product or global policy, the respective sequence will therefore be called and incremented anytime this view is open, even if the picking is not creating lots (e.g. delivery orders or internal transfers)
To avoid incrementing the sequence unnecessarily, we only allow to get the next sequence number the first time this view is opened and if the move has to create new serial numbers.
Otherwise, we force the value to be set to stock.move.next_serial field to an empty string if no serial has to be created through this move, or to the next_serial value assigned on the first opening of the view.