[Extensibility Request] issue 30434: add purchase prepayment amount event - #10898
[Extensibility Request] issue 30434: add purchase prepayment amount event#10898Marko Aleksandric (AleksandricMarko) wants to merge 1 commit into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
In the NA layer, the overloaded Agent judgement — not directly backed by a BCQuality knowledge article. Line mapping was unavailable, so this was posted as an issue comment. 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.35.4 |
Good Sense Reviewer - Round 1Recommendation: Accept with SuggestionsWhat this PR doesThe change adds OnBeforePrepmtAmount to the purchase prepayment amount calculation in each BaseApp layer. It changes PrepmtAmount to use a named Result, raises the publisher before the standard case statement, and exits only when IsHandled is set. This keeps current behavior unchanged when there is no subscriber. The placement matches the sales-side pattern and passes the purchase line by var, the document type, the result, and the handled flag, so subscribers can replace the returned amount when needed. Problem-solution fitFit: Strong The requested behavior is an override point before the purchase prepayment amount is calculated. The diff adds that handled publisher at the start of the calculation in every current purchase layer and preserves the standard calculation when the event is not handled. SuggestionsS1 (🟠 Moderate): Expose IncludeTax in NA event Risk assessment and necessityRisk: The regression surface is codeunit 444 purchase prepayment amount calculation in W1, APAC, ES, IT, NA, and NL. Standard behavior is unchanged unless a subscriber sets IsHandled, so the main risk is the public event contract; the NA layer has extra tax-inclusion context that affects the final amount. Necessity: The change is needed because purchase prepayment amount calculation has no matching override point while the parallel sales calculation already has one. The scope is narrow and limited to the publisher plus the early handled exit in the existing calculation procedures.
|
alexei-dobriansky
left a comment
There was a problem hiding this comment.
Please check the suggestion.
|
Summary
Extensions cannot currently override the prepayment amount calculated for purchase documents, even though the equivalent sales calculation is extensible. This change adds a handled event before the purchase prepayment calculation so subscribers can provide the result when standard logic does not meet their requirements.
Source issue repository: microsoft/AlAppExtensions; issue number: 30434
Changes Made
Purchase-Post Prepayments.PrepmtAmount- addedOnBeforePrepmtAmountwith an overridable result and propagated the event to all existing layer counterparts while preserving localized calculation logicFixes AB#647921