Skip to content

[Subcontracting] Fix excess reservations on transfer orders (bugs 634399, 634236)#8218

Draft
ChethanT wants to merge 1 commit into
mainfrom
bugs/Subcontracting/634399-TOReservedWithItemTrkIssue
Draft

[Subcontracting] Fix excess reservations on transfer orders (bugs 634399, 634236)#8218
ChethanT wants to merge 1 commit into
mainfrom
bugs/Subcontracting/634399-TOReservedWithItemTrkIssue

Conversation

@ChethanT
Copy link
Copy Markdown
Contributor

@ChethanT ChethanT commented May 20, 2026

Summary

Fixes ADO bugs 634399 and 634236.

When a subcontracting purchase order quantity is reduced and the production order component has reservations exceeding the new transfer line quantity, creating a transfer order would previously transfer all reservations regardless of the transfer line quantity, causing inconsistent reservation states and item tracking corruption.

Fix

Option chosen: Block transfer creation when excess reservations exist.

When the transfer line quantity (based on the reduced PO qty) is less than the total reserved quantity on the production order component, the system now raises an error instructing the user to cancel existing reservations on the component before creating a partial transfer.

This avoids:

  • Inconsistent data states (reservations exceeding transfer quantities)
  • Item tracking corruption with serial/lot numbers
  • Silent data loss from automatic reservation cancellation

The user retains full control: they can manually cancel or adjust reservations on the component and then retry the transfer creation.

Changes

  • SubcCreateTransfOrder.Report.al: Added error check before reservation transfer - blocks when reserved qty > transfer line qty
  • SubcontractingManagement.Codeunit.al: Simplified TransferReservationEntryFromProdOrderCompToTransferOrder (no partial logic needed), removed CancelExcessComponentReservations
  • SubcTransfOrdReservTest.Codeunit.al (new): 4 integration tests covering full transfer, blocked partial transfer (plain and serial), and partial without reservations

Test Coverage

Test Scenario
FullQuantityTransferTransfersAllReservationsWithoutConfirm Full PO qty - all reservations transfer normally
PartialQuantityWithReservationsBlocksTransferCreation Reduced PO qty + reservations - Error blocks transfer
PartialQuantitySerialReservationsBlocksTransferCreation Reduced PO qty + serial reservations - Error blocks transfer
PartialQuantityWithoutReservationsAllowsTransferCreation Reduced PO qty + no reservations - Transfer succeeds

Fixes AB#634399
Fixes AB#634236

@ChethanT ChethanT requested a review from a team as a code owner May 20, 2026 11:35
@github-actions github-actions Bot added the AL: Apps (W1) Add-on apps for W1 label May 20, 2026
@ChethanT ChethanT marked this pull request as draft May 20, 2026 11:36
@github-actions github-actions Bot added this to the Version 29.0 milestone May 20, 2026
…9, 634236)

When a subcontracting purchase order quantity is reduced and the production
order component has reservations exceeding the new transfer line quantity,
block transfer order creation with a clear error message instructing the
user to cancel existing reservations first.

This prevents inconsistent data states where reservation quantities
exceed transfer line quantities, avoiding downstream issues with
item tracking and reservation entry corruption.

Fixes AB#634399
Fixes AB#634236

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ChethanT ChethanT force-pushed the bugs/Subcontracting/634399-TOReservedWithItemTrkIssue branch from 3c25ffd to 0627dfc Compare May 20, 2026 13:39
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant