Skip to content
This repository was archived by the owner on Oct 19, 2026. It is now read-only.

[Bug]: xRechnung/ZUGFeRD export missing TaxExemptionReason and unsupported VATEX codes - #29904

Closed
Miljan Milosavljević (miljance) wants to merge 3 commits into
microsoft:mainfrom
miljance:EDocVATEXCodes
Closed

Miljan Milosavljević (miljance) wants to merge 3 commits into
microsoft:mainfrom
miljance:EDocVATEXCodes

Conversation

@miljance

@miljance Miljan Milosavljević (miljance) commented Apr 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

E-Document for Germany - XRechnung/ZUGFeRD VATEX compliance and BR-DE rule fixes

VATEX Implementation:

  • Export dynamic VATEX code and tax exemption reason from VAT Posting Setup
  • Support 'Not Subject to VAT' (Category O) via VAT Clause integration
  • Added comprehensive test coverage for XRechnung and ZUGFeRD with all VATEX codes

EN16931 & BR-DE Compliance Fixes:

  • BR-O-02: Skip Seller/Buyer VAT ID only when ALL invoice lines are category 'O' (fixed critical bug: previously skipped if ANY line was 'O', breaking mixed invoices)
  • BR-O-05: Remove tax percent from line-level 'O' category elements
  • BR-DE-14: Always include tax percent at document level

Code Architecture:

  • Split tax category insertion into line-level and document-level procedures
  • Separated AllowanceCharge handling by context (6-param line-level, 11-param document-level)
  • Thread document language code to GetVATClauseInfo for localized exemption descriptions

Files Changed:

  • XRechnung: Export logic refactored for UBL compliance
  • ZUGFeRD: CII format aligned with EN16931 requirements
  • Tests: Added VATEX scenarios for all supported exemption categories

Work Item(s)

Fixes #29863

Fixes AB#630660

… rule fixes

**VATEX Implementation:**
- Export dynamic VATEX code and tax exemption reason from VAT Posting Setup
- Support 'Not Subject to VAT' (Category O) via VAT Clause integration
- Added comprehensive test coverage for XRechnung and ZUGFeRD with all VATEX codes

**EN16931 & BR-DE Compliance Fixes:**
- BR-O-02: Skip Seller/Buyer VAT ID only when ALL invoice lines are category 'O'
  (fixed critical bug: previously skipped if ANY line was 'O', breaking mixed invoices)
- BR-O-05: Remove tax percent from line-level 'O' category elements
- BR-DE-14: Always include tax percent at document level

**Code Architecture:**
- Split tax category insertion into line-level and document-level procedures
- Separated AllowanceCharge handling by context (6-param line-level, 11-param document-level)
- Thread document language code to GetVATClauseInfo for localized exemption descriptions

**Files Changed:**
- XRechnung: Export logic refactored for UBL compliance
- ZUGFeRD: CII format aligned with EN16931 requirements
- Tests: Added VATEX scenarios for all supported exemption categories
@miljance

Copy link
Copy Markdown
Contributor Author

Kilian Seizinger (@pri-kise) Could you take a look please?

@JesperSchulz

Copy link
Copy Markdown
Contributor

Miljan Milosavljević (@miljance), could you resolve the merge conflict?

…nto EDocVATEXCodes

# Conflicts:
#	Apps/DE/EDocumentDE/app/src/XRechnung/ExportXRechnungDocument.Codeunit.al
…nto helper procedure

Replace hardcoded comparisons to 'O' (Not Subject to VAT) with a named helper procedure
for better maintainability and code clarity.

- Add IsTaxCategoryNotSubjectToVAT() helper procedure
- Update InsertClassifiedTaxCategory to use the helper
- Update both DetectNotSubjectToVATLines overloads to use the helper
- Centralizes the 'O' value in one location for easier future maintenance
@JesperSchulz Jesper Schulz-Wedde (JesperSchulz) added Finance GitHub request for Finance area linked Issue is linked to a Azure Boards work item processing-PR The PR is currently being reviewed labels Apr 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Processing this PR. The branch is now locked 🔒 Please don't push updates unless otherwise agreed.

@JesperSchulz

Copy link
Copy Markdown
Contributor

Build fails:

App\Apps\DE\EDocumentDE\TempSource\app\src\ZUGFeRD\ExportZUGFeRDDocument.Codeunit.al(40,24): error AL0185: Codeunit 'E-Document VAT Helper' is missing
App\Apps\DE\EDocumentDE\TempSource\app\src\XRechnung\ExportXRechnungDocument.Codeunit.al(43,24): error AL0185: Codeunit 'E-Document VAT Helper' is missing

@miljance

Copy link
Copy Markdown
Contributor Author

closing as the changes from E-Documents Core are moved to PEPPOL app.

@JesperSchulz

Copy link
Copy Markdown
Contributor

Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. Please do not reply to this, as we do not monitor closed issues. If you have follow-up questions or requests, please create a new issue where you reference this one.

Build ID: 50104.

@JesperSchulz

Copy link
Copy Markdown
Contributor

This was merged. Not sure why the automation closed it. But never mind! This repo is getting retired anyway ☺️

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

Labels

Finance GitHub request for Finance area linked Issue is linked to a Azure Boards work item processing-PR The PR is currently being reviewed ships-in-future-update Fix ships in a future update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: xRechnung/ZUGFeRD export missing TaxExemptionReason and unsupported VATEX codes

3 participants