Skip to content

[main] Bug 647499 Bin Replenishment with Pick by FEFO Creates Incorrect Inventory Movements - #10522

Draft
MSNehaNawal wants to merge 1 commit into
mainfrom
bugs/Bug-647067-main-BinReplenishment_FEFOPick_IncorrectInvt
Draft

[main] Bug 647499 Bin Replenishment with Pick by FEFO Creates Incorrect Inventory Movements#10522
MSNehaNawal wants to merge 1 commit into
mainfrom
bugs/Bug-647067-main-BinReplenishment_FEFOPick_IncorrectInvt

Conversation

@MSNehaNawal

@MSNehaNawal MSNehaNawal commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Bug 647499: [master][ALL-E] Bin Replenishment with Pick by FEFO Creates Incorrect Inventory Movements and Leaves Movement Worksheet Lines Unprocessed in Basic Warehouse Locations

Fixes AB#647499

Issue
Bin Replenishment with Pick by FEFO Creates Incorrect Inventory Movements and Leaves Movement Worksheet Lines Unprocessed in Basic Warehouse Locations

Root cause
Under Pick According to FEFO, Calculate Bin Replenishment leaves the worksheet line's From Bin blank (FEFO picks source bins at movement time). In codeunit 7322 this blank From Bin breaks two things:
1.Wrong quantity: CalcQtyAvailToPickOnBins counts a lot's stock across all bins including the destination bin. When the earliest FEFO lot already sits in the bin being replenished, that quantity gets reserved but can't be moved (can't move a bin onto itself), so it's dropped instead of rolling to the next lot — the movement comes up short.
2.Worksheet not cleared: UpdateHandledWhseActivityLineBuffer records the handled qty under the real take bin, but DeleteHandledWhseWorksheetLines matches it back to the worksheet line on From Bin (blank) — keys never match, so lines aren't removed and no confirmation shows.

Solution
CalcQtyAvailToPickOnBins: for a FEFO inventory movement, exclude the destination bin from the availability sum so FEFO moves on to the next movable lot and fulfills the full quantity.
UpdateHandledWhseActivityLineBuffer: when the source line is FEFO (blank From Bin), record the buffer under a blank From Bin so it reconciles with the worksheet line and the handled lines are deleted.

@github-actions github-actions Bot added the SCM GitHub request for SCM area label Aug 21, 2026
@github-actions github-actions Bot added this to the Version 29.0 milestone Aug 21, 2026
@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Agentic PR Review - Round 1

Recommendation: Request Changes

What this PR does

The fix targets Bin Replenishment with Pick by FEFO in basic warehouse locations (codeunit 7322). When FEFO leaves the worksheet line's From Bin blank, two problems occur: the availability sum counts the earliest lot already sitting in the destination bin (which cannot be moved onto itself), so the movement comes up short; and the handled-quantity buffer is recorded under the real take bin while the worksheet line matches on the blank From Bin, so lines are never cleared.

The two changes are aligned with those root causes: CalcQtyAvailToPickOnBins now excludes the destination bin from the availability sum, and UpdateHandledWhseActivityLineBuffer records the buffer under a blank From Bin for FEFO so it reconciles with the worksheet line. The logic reads correctly for the described scenario, but the destination-bin exclusion is broader than FEFO (see S2), and this data-integrity change ships with no automated test (see S1).

Suggestions

S1 - No automated test for inventory movement fix
This change alters how inventory movement quantities and worksheet cleanup are computed - a data-integrity path where a wrong result means incorrect stock movements. It needs a regression test. The warehouse test libraries already support this (location with Pick According to FEFO, bin replenishment, movement worksheet). Please add a test that reproduces the short movement and the unprocessed worksheet line, then passes with the fix.

S2 - Destination-bin exclusion is not limited to FEFO
In CalcQtyAvailToPickOnBins the new else branch applies to every inventory movement with a blank From Bin and a set destination bin (IsInvtMovement), not only FEFO. The buffer change in UpdateHandledWhseActivityLineBuffer guards on CurrLocation."Pick According to FEFO", but this one does not. Please confirm this wider scope is intended and does not change quantities for non-FEFO basic-warehouse movements, or add the same FEFO guard.

Risk assessment and necessity

Risk: Medium-high. Codeunit 7322 drives inventory pick and movement creation for all basic warehouse locations, so a change to availability summing and handled-line buffering has a wide blast radius. The destination-bin exclusion (S2) is not FEFO-gated, so non-FEFO movements can also be affected. Without a test, a regression here would surface as wrong on-hand quantities in the field.

Necessity: The scenario is valid and important - incorrect inventory movements and stuck worksheet lines are a real data-integrity defect. The fix is warranted; it just needs test coverage and a confirmed scope before it can merge safely.


[AI-PR-REVIEW] version=1 promptVersion=2 system=github pr=10522 round=1 by=alexei-dobriansky at=2026-08-23T00:12:40Z lastSha=e131a5494030366989cfe94ff92971b32667b327 reviewKey=ebb2f337a40196c6854b4683eb060bb622827f5d281788dc4afc8ce77bcc20a1 suggestions=S1@b7ec42ab,S2@1ddae17f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

SCM GitHub request for SCM area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants