Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Seeking template for the generation of EN16931 (ZugFERD) compliant E-invoice xml

Our small company is being required to supply EU-compliant E-invoices. I have found the Python package factur-x, and the factur-x plug-in for libreoffice. Unfortunately the latter generates only minimal factur-X invoices, and our customers are telling us that these are insufficient.

Can anybody help me with pointers either to other open-source software, or to English-language examples or descriptions of the required xml?

Ideally, a Django template that could convert a Python dict or suchlike context into the relevant xml, for merging into a pdf invoice (which factur-x can do). Any other macro or template language would do. But I'll take any help I can get. I can't read standards documents written in German!

like image 348
nigel222 Avatar asked Oct 19 '25 10:10

nigel222


2 Answers

Working on the same topic at the moment.

For generating the xml with Python, take a look at this library: https://github.com/invinet/python-en16931

Unfortunately this library seems to be not maintained since the last years but can serve as a good starting point.

With the factur-x library you have already found you can merge the xml to the pdf but keep in mind that you will need the PDF/A3 format to make the invoice compliant. So either the original PDF already has the A3 archive format or - the way I prefer - is to use ghostscript to merge the xml. See https://ghostscript.com/zugferd.html

EDIT:


Also take a look in the xsd-folder that comes with the factur-x-Library - there you have the XML schema description files needed to create a compliant xml.

like image 93
TWP Avatar answered Oct 22 '25 07:10

TWP


I found this library very useful:

https://github.com/pretix/python-drafthorse

It allows creating the xml file from scratch and provides for exporting various ZUGFeRD schemas.

Creation example:

# Build data structure
doc = Document()
doc.context.guideline_parameter.id = "urn:cen.eu:en16931:2017#conformant#urn:factur-x.eu:1p0:extended"
doc.header.id = "RE1337"
doc.header.type_code = "380"
doc.header.name = "RECHNUNG"
doc.header.issue_date_time = date.today()
doc.header.languages.add("de")
...

And it is still maintained, last commit 4 hours ago.

like image 41
HeyMan Avatar answered Oct 22 '25 06:10

HeyMan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!