Bug 636820, 634465, 634396: [Subcontracting] Fix reservation error when received quantity exceeds component need#8395
Open
alexei-dobriansky wants to merge 1 commit into
Conversation
…en received quantity exceeds component need When a transfer back from the subcontractor is posted with a tracked quantity that exceeds the production order component's remaining need, reservation failed with "Reserved quantity cannot be greater than 0". The receipt-side transfer of reservation entries now caps the reserved quantity to the component's remaining need. Lot- and package-tracked entries are reserved partially (both are divisible); serial-tracked entries are skipped when they no longer fully fit. Excess received quantity is left as free inventory. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
What & why
When a transfer back from the subcontractor is posted with a tracked quantity that exceeds the production order component's remaining need, reserving the receipt failed with "Reserved quantity cannot be greater than 0" (ADO bugs 636820, 634465, 634396).
The receipt-side transfer of reservation entries (
TransferReservationEntryFromPstTransferLineToProdOrderComp) now caps the reserved quantity to the component's remaining need:Item ledger entry quantities are read directly as base quantity (always base UOM), and the demand quantity is converted from base using the component's
Qty. per Unit of MeasureviaUnit of Measure Management.Linked work
AB#636820
AB#634465
AB#634396
What I tested and the outcome
Added three regression tests in
SubcTransOrdReservTest.Codeunit.althat call the receipt-side reservation transfer directly with an in-memoryTransfer Receipt Linereconstructed from a posted item ledger entry:ExcessLotQuantityReceiptReservesOnlyComponentNeed— need 10, receive 15 in one lot → reserves 10 (single capped entry), 5 free.ExcessSerialQuantityReceiptReservesOnlyComponentNeed— need 3, receive 5 serials → reserves 3, skips 2 excess serials.ExcessPackageQuantityReceiptReservesOnlyComponentNeed— need 10, receive 15 in one package → reserves 10 (single capped entry), 5 free.Risk & compatibility
Scoped to the subcontracting receipt-side reservation transfer. Behavior change is limited to the over-received case, which previously errored; the exact-fit and under-received paths are unchanged.