[Master]-When we run the Order Planning Worksheet by Project, a supply suggestion is created for items that are already received but not invoiced in Purchase Orders, but only after updating Order and Posting Dates on Purchase Order. - #10225
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes an Order Planning (by Project/Job Demand) issue where supply could be re-suggested for Purchase Order quantities that were already received but not invoiced after updating PO Order/Posting Dates.
Changes:
- Update Job Demand netting to also account for Qty. Rcd. Not Invoiced (Base) when computing remaining needed quantity.
- Add a regression test covering the “received-not-invoiced after date change” scenario and a confirm handler used by the test run.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/Layers/W1/Tests/SCM-Planning/SCMOrderPlanningI.Codeunit.al | Adds a regression test for AB#646661 and introduces a generic confirm handler used by the test. |
| src/Layers/W1/BaseApp/Inventory/Requisition/GetUnplannedDemand.Codeunit.al | Adjusts Job Planning Line needed-qty calculation to net against received-not-invoiced purchase quantities. |
Suppressed comments (1)
src/Layers/W1/Tests/SCM-Planning/SCMOrderPlanningI.Codeunit.al:43
- The ValidationError label contains a double space after %1, which makes assertion messages look malformed.
ValidationError: Label '%1 must be %2 in %3.';
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Agentic PR Review - Round 1Recommendation: AcceptWhat this PR doesThis PR fixes Order Planning for Job Demand so a purchase order line that is received but not invoiced is still counted as supply for the related project planning line. The change is in the early demand gate in GetUnplannedDemand, so the job demand is not inserted when the only remaining quantity is already covered by outstanding or received-not-invoiced purchase quantity. The added test follows the reported date-change scenario and checks that the second calculation creates no requisition lines. SuggestionsNo suggestions. Risk assessment and necessityRisk: This is planning logic for project-related purchase supply. A wrong result can create an extra purchase suggestion, but the change is narrow: it reads one existing Purchase Line quantity field using the same job, task, planning line, and item filters already used for outstanding quantity. There is no public API change, no event signature change, and no posting code is changed. Necessity: The work item gives a clear customer repro where changing dates on a purchase order makes Order Planning suggest supply that has already been received. The fix is needed because the later received-not-invoiced reduction is date-filtered, while this early gate decides whether the job demand is inserted at all.
|
Fixes AB#646661