[FIX] stock: fix lot when updating move line & unable to reserve quants#64497
Closed
[FIX] stock: fix lot when updating move line & unable to reserve quants#64497
Conversation
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.
Install stock
Go to Inventory > Configuration > Settings and enable "Lots" and "Storage Locations"
Create a Product tracked By Lots (i.e. Product X)
Go to Inventory > Operations > Inventory Adjustments
Create an Inventory Adjustment for Product X:
Product | Location | Lot/SN | Real Quantity
Product X | WH/Stock | LOT 01 | 20
Product X | WH/Stock | False | 10
Validate Inventory
Go to Inventory > Operations > Transfers and create one:
[Product: Product X, Initial Demand: 25]
Save Transfer, Mark As Todo and Check availability
Click on list icon of Operation line for Product X to display Detailed Operations
20 units of LOT 01 and 5 units without lot have been reserved
Set LOT 01 for the 5 reserved units without lot and confirm
Open Detailed Operations again
There are now 20 units of LOT 01 and 5 units of LOT 01
Remove the row with 5 units and confirm
Check availability and open Detailed Operation
There is now only a row with 25 reserved units of LOT 01
Unreserve
The following errror is raised:
"It is not possible to unreserve more products of P than you have in stock."
This is due to a mismatch between Lot and Quant.
When updating lot_id of the 5 units without lot with LOT 01, it tries to reserve 5 Quants
of LOT 01. As there is no more Quant available for LOT 01, it reserves 5 untracked Quants
instead.
However it still updates lot_id of move line to LOT 01, which is incorrect.
So when the move line with the 5 units is removed, it unreserves 5 units of LOT 01, although
it was untracked units that were reserved.
This is leading to incorrect data in "stock.quant" table:
To prevent this to happen, lot_id of move line has to be set to False if untracked quants
have been reserved as a fallback.
opw-2419444
Description of the issue/feature this PR addresses:
Current behavior before PR:
Desired behavior after PR is merged:
--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr