Skip to content

[PEPPOL] Skip Allocation Account lines in sales document validation#8660

Open
Groenbech96 wants to merge 3 commits into
mainfrom
magnushar/peppol-allocation-account-632064
Open

[PEPPOL] Skip Allocation Account lines in sales document validation#8660
Groenbech96 wants to merge 3 commits into
mainfrom
magnushar/peppol-allocation-account-632064

Conversation

@Groenbech96

@Groenbech96 Groenbech96 commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Releasing a sales document that contains a sales line of type Allocation Account failed PEPPOL BIS 3 validation with "You must specify a valid International Standard Code for the Unit of Measure for ." (empty UoM message tail). Posting the same document works.

Root cause

PEPPOL30 Sales Validation Impl.CheckSalesDocumentLine calls PEPPOL30.GetLineUnitCodeInfo, whose case SalesLine.Type only handles Item, Resource, G/L Account, Fixed Asset and Charge (Item). There is no branch for Type::"Allocation Account", so unitCode stays empty and the guard (Type <> ' ') and ("No." <> '') and (unitCode = '') errors.

Allocation account lines are placeholder lines that are expanded into their underlying G/L distribution lines during posting and are never themselves exported in the electronic document. Posting works because the post-time PEPPOL check iterates the posted lines (only G/L Account lines); the release-time check iterates the unposted sales lines, which still contain the allocation account placeholder.

Fix

Skip lines of type Allocation Account early in CheckSalesDocumentLine, mirroring posting behavior. Adds a regression test (TestPeppolValidationSalesInvoiceAllocationAccountLineSkipped).

This mirrors the equivalent fix in the Base Application (internal Bug 632064).

AB#632064

Releasing a sales document containing an Allocation Account line failed PEPPOL
BIS 3 validation ("You must specify a valid International Standard Code for the
Unit of Measure...") because PEPPOL30 Sales Validation Impl.CheckSalesDocumentLine
has no branch for Type::"Allocation Account", leaving unitCode empty.

Allocation account lines are placeholder lines expanded into their underlying
G/L distribution lines during posting and are never themselves exported in the
electronic document, so skip them early - mirroring posting behavior and the
Base Application fix for the same issue. Adds a regression test.
@Groenbech96 Groenbech96 requested a review from a team as a code owner June 18, 2026 05:43
@github-actions github-actions Bot added the AL: Apps (W1) Add-on apps for W1 label Jun 18, 2026
@github-actions github-actions Bot modified the milestone: Version 29.0 Jun 18, 2026
Instead of skipping Allocation Account lines, expand them via
Allocation Account Mgt.GenerateAllocationLines and run the existing
sales-line validation against each underlying G/L destination account
(the accounts the line is expanded into during posting). Addresses
review feedback.
Table 2672 "Allocation Line" has TableType = Temporary, so the variable
is implicitly temporary and CodeCop rule AA0073 requires the Temp prefix.
Rename AllocationLine to TempAllocationLine in CheckAllocationAccountExpandedLines.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
end;
end;

local procedure CheckAllocationAccountExpandedLines(SalesLine: Record "Sales Line")

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.

$\textbf{🟠\ High\ Severity\ —\ Performance} \quad \color{gray}{\texttt{\small Iteration\ 1}}$

AllocationLine not declared temporary

TempAllocationLine: Record "Allocation Line" is missing the temporary keyword. If GenerateAllocationLines inserts into this record variable, it will write to the real Allocation Line table during PEPPOL validation — corrupting production data.

Recommendation:

  • Add the temporary keyword to the declaration: TempAllocationLine: Record "Allocation Line" temporary;
Suggested change
local procedure CheckAllocationAccountExpandedLines(SalesLine: Record "Sales Line")
TempAllocationLine: Record "Allocation Line" temporary;

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why

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

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

Labels

AL: Apps (W1) Add-on apps for W1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant