Skip to content

Bug 8845 Old Prices Calculated in Req. Worksheet - #10213

Open
Dan Karlsson (Dan-Karlsson) wants to merge 2 commits into
microsoft:mainfrom
Dan-Karlsson:Bug8845-old-prices-calc-in-req-worksheet
Open

Bug 8845 Old Prices Calculated in Req. Worksheet#10213
Dan Karlsson (Dan-Karlsson) wants to merge 2 commits into
microsoft:mainfrom
Dan-Karlsson:Bug8845-old-prices-calc-in-req-worksheet

Conversation

@Dan-Karlsson

@Dan-Karlsson Dan Karlsson (Dan-Karlsson) commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

What & why

Does not set Order Date in Requisition Line to an older date than workdate when validating other fields, to make the price calculations correct.
Only update Starting Date when it is also validated to not set a faulty starting date. Also doesn't make sense to set starting date without validation since the field Starting Date-Time will not be synchronised.

Same pull request as microsoft/BusinessCentralApps#1869 that was closed when base app moved.

Linked work

Fixes #8845

How I validated this

  • I read the full diff and it contains only changes I intended.
  • I built the affected app(s) locally with no new analyzer warnings.
  • I ran the change in Business Central and confirmed it behaves as expected.
  • I added or updated tests for the new behavior, or explained below why none are needed.

What I tested and the outcome (required — be specific: scenarios, commands, screenshots for UI changes)

  • Ran Calculate Plan... in Requistion Worksheet to see the results
  • Added unit test in SCMPlanReqWksht.Codeunit.al
  • Fixed old tests that relied on order date in the past to pass

Risk & compatibility

Starting Date isn't set when validating Order Date on Requisition Line from code. Should be a small risk since Starting Date-Time wasn't synchronised without further field validations.

@github-actions github-actions Bot added From Fork Pull request is coming from a fork SCM GitHub request for SCM area needs-approval Workflow runs require maintainer approval to start labels Aug 12, 2026
@Dan-Karlsson Dan Karlsson (Dan-Karlsson) changed the title Changes from https://github.com/microsoft/BusinessCentralApps/pull/1869 Bug 8845 Old Prices Calculated in Req. Worksheet Aug 13, 2026
@Dan-Karlsson
Dan Karlsson (Dan-Karlsson) marked this pull request as ready for review August 13, 2026 15:08
@Dan-Karlsson
Dan Karlsson (Dan-Karlsson) requested a review from a team August 13, 2026 15:08
@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Agentic PR Review - Round 1

Recommendation: Accept

What this PR does

This fixes purchase price calculation on requisition lines when planning dates would place the order date before the work date. The code now keeps price calculation on the work date while preserving the calculated starting date unless the Order Date field is validated directly. The main changed paths use Order Date as the price document date, so the old-price case is addressed without changing posting code or public APIs. The added regression test covers two vendor price periods and checks that the current price is selected.

Suggestions

No suggestions.

Risk assessment and necessity

Risk: This touches requisition worksheet planning dates and purchase direct unit cost. A mistake here could choose the wrong vendor cost on planned supply, but the change is narrow and does not change posting code, event signatures, or public procedure signatures.

Necessity: The linked bug is valid because a rush order can otherwise use an obsolete purchase price when lead time pushes the calculated order date into the past. The scope is right for the issue, and the tests cover the price regression plus related planning date expectations.


[AI-PR-REVIEW] version=1 promptVersion=2 system=github pr=10213 round=1 by=alexei-dobriansky at=2026-08-14T08:47:44Z lastSha=1df8d04b084f632029abc9c4608df9d1685c3868 reviewKey=na suggestions=

@github-actions github-actions Bot removed the needs-approval Workflow runs require maintainer approval to start label Aug 14, 2026
Comment thread src/Layers/W1/Tests/SCM-Planning/SCMPlanReqWksht.Codeunit.al
@github-actions github-actions Bot added the needs-approval Workflow runs require maintainer approval to start label Aug 14, 2026
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 needs-approval Workflow runs require maintainer approval to start SCM GitHub request for SCM area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Old Prices Calculated in Req. Worksheet

2 participants