[29.x] Bug 69369 Movement Worksheet Creates Incorrect Warehouse Movement for FEFO Lot-Tracked Items - #11194
Conversation
Good Sense Reviewer - Round 1Recommendation: AcceptWhat this PR doesThis PR adjusts Create Pick availability for movement worksheet lines on directed put-away and pick locations. When the destination is not a ship zone, it removes quantity already on outbound bins before FEFO availability is added, so picked-not-shipped stock is not offered as a movement source. The added regression test sets up a FEFO lot-tracked item with one lot partly picked to shipment and partly assigned to an open pick, then verifies the movement uses the next lot. The code follows the existing movement-from-ship-zone guard and keeps the subtraction limited to the movement worksheet path. Problem-solution fitFit: Strong The reported scenario is specific: FEFO movement replenishment must ignore lot quantity that cannot be moved because it is outbound or already assigned to a pick. The diff changes that exact availability calculation and adds a test that exercises both picked-not-shipped and pending-pick quantities. SuggestionsNo suggestions. Risk assessment and necessityRisk: The regression surface is the movement worksheet FEFO availability calculation for directed put-away and pick locations. The code path affects inventory movement and lot selection, but the change is narrow, keeps ship-zone destinations exempt through the existing Necessity: The change is required because movement creation can otherwise choose an FEFO-earlier lot that is already unavailable for movement, producing an incorrect warehouse movement. The scope is right for a bug fix: one availability adjustment plus a focused regression test.
|
Bug 649369: [29.x][ALL-E] Movement Worksheet Creates Incorrect Warehouse Movement for FEFO Lot-Tracked Items When Picked-Not-Shipped and Pending Picks Exist. - regression.
Fixes AB#649369
Issue
Movement Worksheet Creates Incorrect Warehouse Movement for FEFO Lot-Tracked Items When Picked-Not-Shipped and Pending Picks Exist.
Root Cause
The availability calculation in CalcTotalAvailQtyToPick (codeunit 7312 "Create Pick") didn't exclude quantity that was already picked but not yet shipped (sitting in an outbound/ship-type bin) or committed to a pending pick. Since a movement can never source stock from the ship zone, this caused the worksheet to select the wrong (FEFO-earliest) lot for the movement — the lot that was already fully committed to outstanding sales orders — instead of the next available lot.
Solution
In CreatePick.Codeunit.al, when called from the Movement Worksheet (CalledFromMoveWksh), subtract the quantity already sitting on outbound bins (WarehouseAvailabilityMgt.CalcQtyOnOutboundBins) from MaxPickableQtyInWhse before it's added to the total available quantity, clamping at zero.