[PEPPOL] Skip Allocation Account lines in sales document validation#8660
[PEPPOL] Skip Allocation Account lines in sales document validation#8660Groenbech96 wants to merge 3 commits into
Conversation
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.
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") |
There was a problem hiding this comment.
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
temporarykeyword to the declaration:TempAllocationLine: Record "Allocation Line" temporary;
| local procedure CheckAllocationAccountExpandedLines(SalesLine: Record "Sales Line") | |
| TempAllocationLine: Record "Allocation Line" temporary; |
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why
|
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.CheckSalesDocumentLinecallsPEPPOL30.GetLineUnitCodeInfo, whosecase SalesLine.Typeonly handles Item, Resource, G/L Account, Fixed Asset and Charge (Item). There is no branch forType::"Allocation Account", sounitCodestays 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 Accountearly inCheckSalesDocumentLine, mirroring posting behavior. Adds a regression test (TestPeppolValidationSalesInvoiceAllocationAccountLineSkipped).This mirrors the equivalent fix in the Base Application (internal Bug 632064).
AB#632064