This project provides a comprehensive solution for viewing invoices XRechnung XML format. It includes both a Python script for standalone PDF generation and a Business Central AL extension for integrated invoice viewing.
- Parses XML invoice files
- Generates PDF invoices with detailed formatting
- Supports comprehensive invoice data extraction including:
- Header information (ID, dates, currency, buyer reference, notes, type code)
- Supplier and customer details
- Contact information (name, phone, email)
- Payment information (means code, account, terms)
- Invoice line items with quantities, prices, discounts
- Tax subtotals and totals
- Legal monetary totals
- Report:
EInvoiceViewer.Report.al- Main report for displaying parsed invoice data - Layout:
Viewer.rdlc- RDLC report layout with comprehensive fields - Integration: Automatic XML parsing and data population into Business Central
- Page Extensions: Integration with Incoming Documents for seamless workflow
pip install reportlab- Import the AL extension files into your Business Central development environment
- Publish and install the extension
- The report will be available under Reports and Analysis
See how the business central integration works:

See how a xml invoice could look like:

python xml_to_invoice_pdf.py input_invoice.xml output_invoice.pdfExample:
python xml_to_invoice_pdf.py 01.01a-INVOICE_ubl.xml invoice.pdf- Navigate to the E-Invoice Viewer report
- Select an XML file when prompted
- The report will automatically parse and display the invoice data
Use incoming documents to validate the xrechnung xml file:

After loading the xml file, our extension generates the pdf file for better visualization:

And now the preview of the pdf file in Business Central:

The solution supports the following invoice elements:
cbc:ID- Invoice numbercbc:IssueDate- Issue datecbc:DocumentCurrencyCode- Currencycbc:BuyerReference- Buyer referencecbc:Note- Invoice notescbc:InvoiceTypeCode- Invoice type
- Supplier details (name, address, contact)
- Customer details (name, address)
- Contact information (name, phone, email)
- Payment means code
- Payee financial account
- Payment terms
- Line ID and description
- Quantity and unit price
- Line amount and discounts
- Tax category and percentage
- Additional line notes and references
- Tax subtotals by category
- Legal monetary totals (line extension, tax exclusive/inclusive amounts)
- Payable amount
- Uses
xml.etree.ElementTreefor XML parsing reportlablibrary for PDF generation- Namespace-aware XPath queries for reliable data extraction
- Comprehensive error handling and data validation
- XML parsing using Business Central's XmlDocument and XmlNamespaceManager
- Data population into temporary Sales Header and Line tables
- RDLC layout for professional report presentation
- Integration with Incoming Documents workflow
app/
├── xml_to_invoice_pdf.py # Python PDF generation script
├── src/
│ ├── EInvoiceViewer.Report.al # Main AL report
│ ├── Viewer.rdlc # Report layout
│ └── PTEAfterImportIntoDoc.Codeunit.al # Integration codeunit
├── 01.01a-INVOICE_ubl.xml # Sample XML file
└── README.md # This file
This project is based on the AL-Go Per Tenant Extension Template. Please refer to the AL-Go documentation for contribution guidelines.
This project is provided as-is for educational and development purposes.