Repository navigation
[18.0][FIX] barcode_stock: keep the locations of the line picked - #18
Open
szalatyzuzanna wants to merge 1 commit into
Open
szalatyzuzanna wants to merge 1 commit into
szalatyzuzanna wants to merge 1 commit into
Conversation
szalatyzuzanna
force-pushed
the
18.0-fix-barcode_stock-line-locations
branch
4 times, most recently
from
October 27, 2026 10:13
f5bd923 to
0d43a2a
Compare
szalatyzuzanna
marked this pull request as ready for review
October 27, 2026 10:47
oliverg09
reviewed
Oct 27, 2026
| rounding = self.product_id.uom_id.rounding | ||
| quants = ( | ||
| self.env["stock.quant"] | ||
| ._gather(self.product_id, source, lot_id=lot) |
There was a problem hiding this comment.
Thanks for the improvements @szalatyzuzanna !
Odoo's _gather() method accepts a qty parameter, which is used by the least_packages removal strategy to select the appropriate quants.
Could we consider passing qty=quantity here to preserve this behavior?
._gather(self.product_id, source, lot_id=lot, qty=quantity)It would also be useful to add a test covering the least_packages removal strategy. This is a minor improvement and not a blocker for this PR.
Author
There was a problem hiding this comment.
Thanks @oliverg09! Done: the lot now comes first from the packages least_packages picks, then from the rest, as qty alone would skip the stock other moves hold. Test added.
Every confirmation from the scanner wrote the move's source and destination on the move line it filled, so a picking reserved in sublocations took its stock from the move's location on validation (negative quants there, the shelves untouched), and a reception lost its putaway shelf. A line now keeps the locations Odoo gave it unless the operator chooses another in the move wizard, which shows the line's. For each reserved line to be picked where it was reserved, a move is picked line by line outside receptions, with lots or without: the wizard works on the first reserved line with something left, and a pick is spread over the reserved lines in turn, each up to what it holds. A lot the reservation does not carry is taken by the server from its own quants under the move's source (removal strategy, least packages included, stock nothing holds first, one line per shelf, package and owner, to the destination the operator chose), as much of the other lots' reservation as it replaces released, rather than written over another lot's line; with no stock there, it is only picked from a source the operator chooses.
szalatyzuzanna
force-pushed
the
18.0-fix-barcode_stock-line-locations
branch
from
October 29, 2026 09:31
0d43a2a to
25cc8f6
Compare
jorgeglez1990
approved these changes
Oct 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up of #17, raised there by @oliverg09. Every confirmation from the scanner writes the move's source and destination on the move line it fills: the move wizard does, and so does the quick re-scan of a product without lots. On a picking reserved in sublocations, validating then takes the stock from the move's location, leaving negative quants there while the shelves keep theirs, and a reception loses the shelf a putaway rule chose.
stock.move.barcode_pick_lotreleases as much of the other lots' reservation as it replaces, reserves the lot under the move's source as Odoo reserves any lot (removal strategy, one line per shelf, package and owner it lies in) and marks those lines picked. Stock other moves hold is taken from where it lies, their reservation freed on validation; what is over goes on the last line. With no stock there, the wizard says so before confirming, and the server refuses it unless the operator chose where it comes from. The wizard shows where the lot lies (stock.quant.barcode_lot_location), but it is the server that decides when the operator confirms.Tests
@BinhexTeam