Skip to content

[Extensibility Request] issue 30216: add OnPostItemJnlLineJobConsumptionOnBeforePrepareJobLine event in codeunit 90 Purch.-Post#9446

Open
AleksandricMarko wants to merge 2 commits into
mainfrom
ai-ext-fix/ext_issue-30216
Open

[Extensibility Request] issue 30216: add OnPostItemJnlLineJobConsumptionOnBeforePrepareJobLine event in codeunit 90 Purch.-Post#9446
AleksandricMarko wants to merge 2 commits into
mainfrom
ai-ext-fix/ext_issue-30216

Conversation

@AleksandricMarko

@AleksandricMarko AleksandricMarko commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

The reporter needs to intervene during purchase posting immediately before InvoicePostingInterface.PrepareJobLine(...) runs for job-linked purchase lines. Under specific custom conditions (based on extension fields) they must adjust PurchLine."Qty. to Invoice" and optionally replace the standard job-line preparation with their own implementation. Existing events fire too early or after preparation has already consumed the value, so none allow this. This PR adds an IsHandled integration event at that exact point so subscribers can modify the quantity and/or skip the standard call.

Source issue repository: microsoft/AlAppExtensions; issue number: 30216

Changes Made

  • OnPostItemJnlLineJobConsumptionOnBeforePrepareJobLine - new IsHandled integration event raised in PostItemJnlLineJobConsumption right after Qty. to Invoice is set and before InvoicePostingInterface.PrepareJobLine is called, letting subscribers adjust the quantity or bypass the standard preparation. IsHandled is initialized to false before the call and the standard call is guarded by if not IsHandled. Applied in the W1 base layer and propagated to the country layers that carry their own copy of the codeunit.

Fixes AB#641618

…reJobLine event in codeunit 90 Purch.-Post

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@AleksandricMarko AleksandricMarko added event-request SCM GitHub request for SCM area labels Jul 14, 2026
@github-actions github-actions Bot added this to the Version 29.0 milestone Jul 14, 2026
@AleksandricMarko
AleksandricMarko marked this pull request as ready for review July 15, 2026 12:40
@AleksandricMarko
AleksandricMarko requested a review from a team July 15, 2026 12:40
Comment thread src/Layers/W1/BaseApp/Purchases/Posting/PurchPost.Codeunit.al
@github-actions

Copy link
Copy Markdown
Contributor

Copilot PR Review

Iteration 1 · Outcome: completed

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

Findings by domain

Findings split into Knowledge-backed (cite a BCQuality article) and Agent (the agent's own judgement, no matching BCQuality rule).

Domain Findings Knowledge-backed Agent Inline Fallback
Events 1 1 0 1 0

Totals: 1 knowledge-backed · 0 agent findings.

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

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

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

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Stale Status Check Deleted

The Pull Request Build workflow run for this PR was older than 72 hours and has been deleted.

📋 Why was it deleted?

Status checks that are too old may no longer reflect the current state of the target branch. To ensure this PR is validated against the latest code and passes up-to-date checks, a fresh build is required.


🔄 How to trigger a new status check:

  1. 📤 Push a new commit to the PR branch, or
  2. 🔁 Close and reopen the PR

This will automatically trigger a new Pull Request Build workflow run.

PredragMaricic
PredragMaricic previously approved these changes Jul 20, 2026
Comment thread src/Layers/W1/BaseApp/Purchases/Posting/PurchPost.Codeunit.al
@@ -1,4 +1,4 @@
// ------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------

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.

S2: Please revert this unrelated UTF-8 BOM removal so the IT file changes only for the requested event.

qasimikram
qasimikram previously approved these changes Jul 23, 2026

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

The event is placed at the requested preparation boundary and is propagated consistently across the localized code copies.

S1: Please add regression coverage for the default and handled posting paths, including a subscriber that changes Qty. to Invoice, performs replacement preparation, and completes without duplicate or missing job-posting data.

S2: Revert the unrelated UTF-8 BOM removal in the IT file so this PR remains limited to the event change.

@AleksandricMarko

Copy link
Copy Markdown
Contributor Author

@copilot Please revert this unrelated UTF-8 BOM removal so the IT file changes only for the requested event

Copilot AI dismissed stale reviews from qasimikram and PredragMaricic via 929eb83 July 23, 2026 17:10

Copilot AI commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

@copilot Please revert this unrelated UTF-8 BOM removal so the IT file changes only for the requested event

Done — the UTF-8 BOM has been restored in the IT file. The IT diff now only contains the event additions (commit Restore UTF-8 BOM in IT PurchPost.Codeunit.al).

@github-actions github-actions Bot added the needs-approval Workflow runs require maintainer approval to start label Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

event-request 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.

4 participants