Skip to content

[Master]-Incorrect Reservation Split Generated After Replanning a Replenishment Production Order Created by MRP Planning Run - #9788

Open
neeleshsinghal wants to merge 3 commits into
mainfrom
bugs/Bug-643972-Reservation-Split-Replanning-a-Replenishment-Prod-Orderv1
Open

[Master]-Incorrect Reservation Split Generated After Replanning a Replenishment Production Order Created by MRP Planning Run#9788
neeleshsinghal wants to merge 3 commits into
mainfrom
bugs/Bug-643972-Reservation-Split-Replanning-a-Replenishment-Prod-Orderv1

Conversation

@neeleshsinghal

@neeleshsinghal neeleshsinghal commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

AB#643972

When the same component item is used on multiple prod. order component lines, replanning kept the old reservation split and only adjusted the delta, producing an incorrect reserved quantity per line.

Fix: A small manufacturing-layer event subscriber (OnAfterShouldDeleteReservEntry) now force-rebuilds the split for these cases. No base-app or schema changes.

@neeleshsinghal
neeleshsinghal requested a review from a team July 28, 2026 10:07
@github-actions github-actions Bot added the SCM GitHub request for SCM area label Jul 28, 2026
@github-actions github-actions Bot added this to the Version 29.0 milestone Jul 28, 2026
VolodySyn
VolodySyn previously approved these changes Jul 28, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses an MRP replanning defect where, if the same component item appears on multiple production order component lines, the reservation split could remain partially based on the old demand, leading to incorrect reserved quantities per component line. The fix introduces logic to force deletion/rebuild of the affected order-to-order reservation entries and adds a regression test to validate the correct split after replanning.

Changes:

  • Add a manufacturing-focused event subscriber on Inventory Profile Offsetting.OnAfterShouldDeleteReservEntry to force deletion of order-to-order reservation entries when the same component item exists on multiple prod. order component lines.
  • Add a new SCM manufacturing test that creates a released production order with the same component twice (different calculation formulas), replans, and verifies the reserved quantity split remains correct.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/Layers/W1/Tests/SCM-Manufacturing/SCMProductionOrdersII.Codeunit.al Adds a regression test plus helper procedures to reproduce and validate the reservation split scenario after replanning.
src/Layers/W1/BaseApp/Manufacturing/Inventory/Tracking/MfgInvtProfileOffsetting.Codeunit.al Adds an event subscriber that forces deletion of reservation entry pairs to ensure the split is rebuilt during replanning for the problematic scenario.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Copilot stopped work on behalf of neeleshsinghal due to an error July 28, 2026 13:54
…ProfileOffsetting.Codeunit.al

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

src/Layers/W1/BaseApp/Manufacturing/Inventory/Tracking/MfgInvtProfileOffsetting.Codeunit.al:188

  • PR description says "No base-app ... changes", but this change is in src/Layers/W1/BaseApp/... and adds behavior to a BaseApp codeunit (99000869). Either update the PR description to reflect that BaseApp is modified, or move the subscriber to the intended non-BaseApp layer so the description stays accurate.
    [EventSubscriber(ObjectType::Codeunit, Codeunit::"Inventory Profile Offsetting", 'OnAfterShouldDeleteReservEntry', '', true, false)]
    local procedure OnAfterShouldDeleteReservEntry(ReservationEntry: Record "Reservation Entry"; ToDate: Date; var DeleteCondition: Boolean; TemplateName: Code[10]; WorksheetName: Code[10])
    var

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.

3 participants