Skip to content

Bug 636820, 634465, 634396: [Subcontracting] Fix reservation error when received quantity exceeds component need#8395

Open
alexei-dobriansky wants to merge 1 commit into
mainfrom
bugs/636820-634465-634396-Subcon_ReservedQuantityIssues
Open

Bug 636820, 634465, 634396: [Subcontracting] Fix reservation error when received quantity exceeds component need#8395
alexei-dobriansky wants to merge 1 commit into
mainfrom
bugs/636820-634465-634396-Subcon_ReservedQuantityIssues

Conversation

@alexei-dobriansky
Copy link
Copy Markdown
Contributor

@alexei-dobriansky alexei-dobriansky commented Jun 1, 2026

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:

  • Lot- and package-tracked entries are reserved partially (both are divisible).
  • Serial-tracked entries are skipped when they no longer fully fit (indivisible).
  • Excess received quantity is left as free inventory instead of failing.

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 Measure via Unit of Measure Management.

Linked work

AB#636820
AB#634465
AB#634396

What I tested and the outcome

Added three regression tests in SubcTransOrdReservTest.Codeunit.al that call the receipt-side reservation transfer directly with an in-memory Transfer Receipt Line reconstructed 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.

…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>
@alexei-dobriansky alexei-dobriansky requested a review from a team as a code owner June 1, 2026 16:13
@alexei-dobriansky alexei-dobriansky self-assigned this Jun 1, 2026
@alexei-dobriansky alexei-dobriansky enabled auto-merge (squash) June 1, 2026 16:14
@alexei-dobriansky alexei-dobriansky added the Subcontracting Subcontracting related activities label Jun 1, 2026
@github-actions github-actions Bot added the AL: Apps (W1) Add-on apps for W1 label Jun 1, 2026
@github-actions github-actions Bot added this to the Version 29.0 milestone Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AL: Apps (W1) Add-on apps for W1 Subcontracting Subcontracting related activities

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant