Skip to content

[master]-Cannot delete Project Planning Line due to incorrect reservation entries#9346

Open
MSNehaNawal wants to merge 12 commits into
microsoft:mainfrom
MSNehaNawal:bugs/Bug-640455-DeleteProjectPlanningLine_ReservationError
Open

[master]-Cannot delete Project Planning Line due to incorrect reservation entries#9346
MSNehaNawal wants to merge 12 commits into
microsoft:mainfrom
MSNehaNawal:bugs/Bug-640455-DeleteProjectPlanningLine_ReservationError

Conversation

@MSNehaNawal

@MSNehaNawal MSNehaNawal commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Bug 642150: [master][ALL-E] Cannot delete Project Planning Line due to incorrect reservation entries

Fixes AB#642150

@github-actions github-actions Bot added From Fork Pull request is coming from a fork Linked Issue is linked to a Azure Boards work item labels Jul 13, 2026
@github-actions github-actions Bot added this to the Version 29.0 milestone Jul 13, 2026
@MSNehaNawal MSNehaNawal changed the title Bugs/bug 640455 delete project planning line reservation error [master]-Cannot delete Project Planning Line due to incorrect reservation entries Jul 13, 2026
@MSNehaNawal
MSNehaNawal requested a review from v-ankitgoyal July 13, 2026 13:46
@MSNehaNawal MSNehaNawal added the SCM GitHub request for SCM area label Jul 13, 2026
@MSNehaNawal
MSNehaNawal marked this pull request as ready for review July 14, 2026 05:22
@MSNehaNawal
MSNehaNawal requested a review from a team July 14, 2026 05:22
Comment thread src/Layers/W1/BaseApp/Inventory/Tracking/InventoryProfileOffsetting.Codeunit.al Outdated
@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Copilot PR Review

Iteration 6 · Outcome: completed

Knowledge source: https://github.com/microsoft/BCQuality@186d8a131465475c79244d994acb872cd5c0d4bf

Orchestrator pre-filter (2 file(s) excluded)

  • layer-disabled (knowledge) : 2 file(s)

Findings produced by the AL review agent v1.7.3. Reply 👎 on any inline comment to flag false positives.

@MSNehaNawal
MSNehaNawal requested a review from a team July 14, 2026 05:31
@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Agentic PR Review - Round 1

Recommendation: Reject Changes

What this PR does

This PR changes Inventory Profile Offsetting so a requisition line for project demand can align Quantity (Base) with SupplyInventoryProfile."Remaining Quantity (Base)" when non-base purchase UoM rounding creates a small base-quantity difference. It also adds a deterministic regression test with Qty. per UoM = 12 that carries out planning to a purchase order, deletes the purchase order, deletes the project planning line, and checks that no reservation entries remain.

The code itself matches the current head of PR 9034 exactly (c887fd7bb3e303e5deeb92896f96ec8db1537a1e). That technical state already addressed the earlier rounding-tolerance and test-coverage concerns on PR 9034. The problem is not the code path now; the problem is that this is a duplicate PR channel for the same branch and same reservation fix.

Suggestions

S1 - Close the duplicate PR channel
PR 9346 and PR 9034 point to the same head commit and contain the same fix. Keep only one PR open so review, CI, and merge history stay in one place. Prefer closing this PR, because PR 9034 already has the review history for this exact code.

S2 - Align the work item reference if kept
This PR body links AB#642150, while the test and the existing PR history refer to scenario 640455. If this PR is kept instead of PR 9034, make the work item link and scenario number consistent before merge.

Risk assessment and necessity

Risk: The changed code is in a sensitive planning and reservation flow. A wrong base quantity can leave orphan reservation entries and block project planning line deletion. The implemented guard is narrow, has no public API change, and the deterministic test covers the Qty. per UoM rounding case and the deletion cleanup path.

Necessity: Bug 640455 is valid and important, and the fix is needed. But this PR is not the right merge channel while PR 9034 is open with the same head commit and review history. This meets the Reject Changes criterion that the PR should not be merged through this duplicate channel and should be consolidated.


[AI-PR-REVIEW] version=1 system=github pr=9346 round=1 by=alexei-dobriansky at=2026-07-14T05:45:29Z lastSha=c887fd7bb3e303e5deeb92896f96ec8db1537a1e suggestions=S1,S2

@MSNehaNawal

Copy link
Copy Markdown
Contributor Author

S1 - Close the duplicate PR channel - Closed original PR
S2 - Align the work item reference if kept - Linked correct workitem

Comment thread src/Layers/W1/Tests/SCM/SCMPlanningNTFtests.Codeunit.al Outdated
v-ankitgoyal
v-ankitgoyal previously approved these changes Jul 14, 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 a planning/reservation rounding edge case that can produce inconsistent reservation entries when carrying out action messages, which then prevents deleting related Job Planning Lines (AB#642150).

Changes:

  • Adjusts requisition line base-quantity alignment in Inventory Profile Offsetting when the only mismatch is attributable to UoM conversion rounding.
  • Adds a new SCM planning regression test covering a Job Planning Line demand with a non-base purchase UoM and verifying cleanup of reservation entries after deletion.

Reviewed changes

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

File Description
src/Layers/W1/Tests/SCM/SCMPlanningNTFtests.Codeunit.al Adds a new regression test and helper procedures to reproduce and validate the reservation-entry rounding/deletion scenario.
src/Layers/W1/BaseApp/Inventory/Tracking/InventoryProfileOffsetting.Codeunit.al Adds logic to align requisition line base quantities with demand when small UoM rounding differences occur.

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

Comment thread src/Layers/W1/BaseApp/Inventory/Tracking/InventoryProfileOffsetting.Codeunit.al Outdated
Comment thread src/Layers/W1/Tests/SCM/SCMPlanningNTFtests.Codeunit.al
Comment thread src/Layers/W1/Tests/SCM/SCMPlanningNTFtests.Codeunit.al
Comment thread src/Layers/W1/Tests/SCM/SCMPlanningNTFtests.Codeunit.al Outdated
@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Agentic PR Review - Round 2

Recommendation: Accept with Suggestions

What this PR does

Since round 1, PR 9034 has been closed, so the duplicate-PR blocker is resolved and PR 9346 is now the single surviving PR channel. The only new AL change is a test comment update in SCMPlanningNTFtests.Codeunit.al; it does not change runtime behavior or test assertions.

The underlying fix remains correct on its own merits. The rounding guard in Inventory Profile Offsetting narrowly aligns Quantity (Base) with the project demand only when the difference is within the unit-of-measure rounding tolerance, and the regression test still covers the non-base purchase UoM flow through planning, purchase order deletion, project planning line deletion, and reservation cleanup.

Status of previous suggestions
ID Title Status Author response
S1 Close the duplicate PR channel Addressed Reply said the original PR was closed; PR 9034 is now closed.
S2 Align the work item reference if kept Not addressed Reply said the correct work item was linked, but the current PR body still links AB#642150 / Fixes AB#642150 while the test and scenario remain 640455.
New observations (commits since round 1)

None - the new commit only changes the test scenario description and introduces no new code or test-logic issue.

Risk assessment and necessity

Risk: The runtime change is still in a sensitive planning and reservation flow, but it is narrow and has no public API or event signature change. The round-2 commit is comment-only, so it adds no new regression surface.

Necessity: Bug 640455 is a valid Bug with clear repro steps for a non-base purchase UoM leaving incorrect reservation entries and blocking project planning line deletion. The code fix and regression test are needed, and the duplicate channel is resolved. The remaining issue is traceability: the PR body should link the same work item as the test and scenario before merge.


[AI-PR-REVIEW] version=1 system=github pr=9346 round=2 by=alexei-dobriansky at=2026-07-14T17:04:12Z lastSha=e0a92bfc53bba688c1e7b277b82ad3979aa3c291 suggestions=S1:addressed,S2:notaddressed parentRound=1

@MSNehaNawal MSNehaNawal reopened this Jul 16, 2026
v-ankitgoyal
v-ankitgoyal previously approved these changes Jul 17, 2026
@neeleshsinghal
neeleshsinghal requested a review from a team July 17, 2026 05:36

@qasimikram qasimikram 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.

Recommendation: Request Changes

S1 - Rounding tolerance misses valid non-base UoMs (High confidence). In InventoryProfileOffsetting.Codeunit.al, the tolerance accounts only for rounding the converted Quantity (Qty. per UoM * 0.00001 / 2), but Requisition Line.Quantity validation then rounds the multiplied base quantity again in UOMMgt.CalcBaseQty. For a valid Qty. per UoM of 1.5 and demand of 1, the round trip is 1 / 1.5 -> 0.66667 -> 1.00001; the difference (0.00001) exceeds the new tolerance (0.0000075), so the base quantity is not aligned and the same reservation inconsistency remains possible. The test only uses Qty. per UoM 12, where the first rounding dominates and the guard happens to pass.

Please include the base-quantity rounding step in the tolerance (respecting Qty. Rounding Precision (Base)) and add a regression case such as 1.5.

Risk: The change is narrow and all required checks pass, but it only fixes a subset of the stated non-base UoM rounding cases in a sensitive reservation path.

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

Labels

From Fork Pull request is coming from a fork Linked Issue is linked to a Azure Boards work item SCM GitHub request for SCM area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants