[28.5] [W1 E-Document] Fix item charge mapping for electronic documents - #11103
Conversation
Backport the W1 E-Document portion of microsoft#9860.
|
Could not find linked issues in the pull request description. Please make sure the pull request description contains a line that contains 'Fixes #' followed by the issue number being fixed. Use that pattern for every issue you want to link. |
Good Sense Reviewer - Round 1Recommendation: Accept with SuggestionsWhat this PR doesThis change adds a reusable classification for how a posted sales item charge is represented when a document is exported as an e-invoice: as a document-level allowance/charge, a line-level allowance/charge, or a separate invoice line with a unit code. It also adds a per-service default, a per-item-charge override, and a fallback unit code (C62) so a charge exported as an invoice line always carries a valid unit code. The classification logic is sound. The "Automatic" path only groups a charge onto an assigned line when there is exactly one assigned line and its VAT category and rate match; otherwise it falls back to a document-level allowance/charge. The code also guards the case where the charge is the only line, exporting it as an invoice line so the document is never left without a document line. The fallback unit price uses Problem-solution fitFit: Strong The reported problem is that item charges exported as invoice lines could carry an empty or invalid unit code and fail EN16931 BR-23 / BR-CL-23 validation. The change fixes this directly by defaulting the exported unit code to C62 and by giving each charge a controlled representation, and it adds broad regression coverage for the classification. This is a maintenance-branch backport of a change already made on the main branch, so the scope matches the original fix. SuggestionsS1 (🟡 Minor): Value-entry lookup does not filter by document type Risk assessment and necessityRisk: The change is additive. The new fields on Necessity: The change is needed to make item-charge e-invoice export standards-compliant (BR-23 / BR-CL-23). Backporting it to the maintenance branch is appropriate so affected customers on this version get the fix. The change is larger than a one-line fix because it introduces the reusable classification the compliant export needs, but it is well contained and covered by matching tests.
|
Why
Item charges exported as synthetic invoice lines can carry an empty or invalid unit code on BT-130, causing EN16931 BR-23 / BR-CL-23 validation failures.
This is the W1 E-Document portion of the releases/28.5 backport of #9860. The German E-Document portion is in NAV PR 253761.
Summary
Fixes
AB#649141