Repository navigation
[18.0][FIX] barcode_stock: keep the locations of the line picked - #18
Conversation
f5bd923 to
0d43a2a
Compare
| 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.
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.
0d43a2a to
25cc8f6
Compare
|
This PR has the |
|
/ocabot merge patch |
|
This PR looks fantastic, let's merge it! |
|
Congratulations, your PR was merged at c6afc97. Thanks a lot for contributing to OCA. ❤️ |
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