LibreOffice Factur-X Extension
This project provides a LibreOffice Extension to generate Factur-X invoices from a spreadsheet. This extension provides a Python macro that can generate a PDF Factur-X invoice or refund at the Minimum profile. These invoices are compatible with Chorus Pro, the e-invoicing plateform of the French administration.
The aim of this project is to allow small companies that don't have an ERP or invoicing software to generate state-of-the-art electronic invoices. With this LibreOffice extension, we can now say that the generation of Factur-X invoices is not limited to companies with a modern ERP: even a tiny company without any IT skills can generate a Factur-X invoice with a simple spreadsheet. And they can do it at no cost using free software only!
The key targets of this project are:
- easy installation: no IT skills needed,
- multi-platform: Windows, Mac, Linux,
- work offline: no Internet connexion needed to generate a Factur-X invoice,
- simplicity and usability for daily invoice generation,
- multi-language: available in French and English (translation to other languages welcomed).
A video tutorial that shows how to install and use this LibreOffice extension is available:
- Version 0.23 dated July 26th 2020:
- Reduce Factur-X PDF file size via the use of flateEncode()
- Version 0.22 dated January 11th 2020:
- New icon for the extension and for the menu entry
- Version 0.21 dated January 8th 2020:
- Add german translation and invoice sample (contributed by Jochen Staerk)
- Add big icon 26px for menu entry (in addition to small icon 16px)
- Version 0.20 dated January 8th 2020:
- Add menu entry File > Export as Factur-X
- Version 0.19 dated January 7th 2020:
- Auto-open PDF after saving it
- Version 0.18 dated January 3rd 2020:
- Add support for additional attachments
- Update invoice samples: new field Number of additional attachments in the 2nd tab
- Version 0.17 dated January 2nd 2020:
- FIX: Don't raise error with invoices with tax amount or residual at 0
- Version 0.16 dated December 31st 2019:
- FIX: field Customer Service Code for Chorus Pro not declared as required field any more
- FIX: avoid crash when fields Issuer SIRET or Issuer VAT Number were empty
- Version 0.15 dated Christmas 2019: first public release.
Roadmap - Known bugs
- Translate to German and other languages
- Add installation instructions for Linux distros other than Debian/Ubuntu
- Lobby to have native support for attachments in LibreOffice PDF export, which would simplify a lot this extension!
Contributions and pull requests are welcomed.
Pre-requisite for Windows and macOS
It is recommended to have LibreOffice 6.2.0 or higher. If your version is older, download a newer version from the LibreOffice website.
Pre-requisite for Linux Debian/Ubuntu
Add the support for Python macros for LibreOffice:
sudo apt install libreoffice-script-provider-python
Pre-requisite for Fedora, Mageia and ArchLinux
No need to install any additional package to support Python macros in LibreOffice.
- Go to the menu Tools > Options and navigate to LibreOffice > Security: click on the button Macro Security and select Medium.
- Download the LibreOffice extension factur-x_macro.oxt.
- Open this file with LibreOffice; it will automatically open the LibreOffice extension manager and propose you to install or upgrade the extension. At the end of the installation, a message will inform you that you need to restart LibreOffice.
If you have LibreOffice older than 6.2.0, you will have a message during installation saying that you need a Java Development Kit (JDK) from Oracle. Please ignore the message, Java is NOT required to use this extension. This message is a bug which was fixed in LibreOffice 6.2.0.
How it works
Get the sample invoice for your language:
- in English: factur-X_english_invoice_sample.ods
- In French: factur-X_modele_facture_francais.ods
You should cutomize this invoice sample for your company (replace the company name, address, logo, VAT number, etc).
The macro to generate Factur-X invoices will work if the spreadsheet complies with the following rules:
- The speadsheet must have at least 2 tabs.
- The 1st tab must contain the invoice. It is that tab which is exported to PDF.
- The 2nd tab must contain the data used to generate the XML file that will be embedded in the PDF. The values are located in the second column of that tab. The macro will read each information in a specific cell. Therefore, you mustn't change the location of each information in that tab.
- In the 2nd tab, some information are required for Factur-X. Among the optional information of the Factur-X standard, some information are required for Chorus Pro. Moreover, if the invoice is for Chorus Pro, be aware that some public entities require the use of a service code and/or an engagement number (equivalent of a purchase order number in the private sector), so these information cannot be left empty if the invoice is for such public entities. The background color of each cell will tell you which are the required information for Factur-X and Chorus Pro (refer to the legend at the bottom of the second tab).
- In the 2nd tab, the third column will tell you the type of each cell (char, date, float) and its constraints.
In the sample invoice, you will see that the values of the 2nd tab are automatically taken from the data of the 1st tab (via a simple = or a formula) except for the currency code (EUR by default). This avoids to copy the information from the 1st tab to the 2nd tab. But it is still recommended to have a fast check of the values of the 2nd tab before generating the Factur-X invoice.
Make it work
To run the macro that will generate the Factur-X PDF invoice, click on the button Generate Factur-X PDF invoice at the bottom of the 2nd tab and follow the instructions.
If the button doesn't work, go to the menu Tools > Macros > Run Macro. Then open My Macros > factur-x_macro.oxt > libreoffice_facturx_macro; in the right column, select the macro generate_facturx_invoice_v1 and click on the button Run; then follow the instructions.
If you want to check the result...
The XML file embedded in the Factur-X PDF file is named factur-x.xml. To view and/or save it, open the PDF file in a modern PDF reader that is able to read attachments in PDF:
- Acrobat Reader: click on the paper clip icon on the left side bar to view the attachments.
- Firefox (recent versions only): click on the paper clip icon at the top left.
- SumatraPDF (Windows): attachments automatically appear on the left side.
- Evince (Linux/Gnome): in the drop-down list at the top left, select Attachments.
- Okular (Linux/KDE): a blue banner automatically appears at the top when the PDF file has attachments.
Factur-X is a franco-german e-invoicing standard that is based on a simple concept: a PDF invoice that embeds an XML file in CrossIndustryInvoice (CII) format. The specifications of the Factur-X standard are available in French and English on the website of the FNFE-MPE. The Factur-X standard has 5 profiles that correspond to 5 levels of details in the information provided in the XML file: Minimum, Basic WL, Basic, EN16931 (that profile corresponds to the EU standard of the same name) and Extended.
About Chorus Pro
Chorus Pro is the e-invoicing portal of the French administration. Starting January 1st 2020, all companies that invoice a public entity (State, local administrations, hospitals, etc.) must send their invoice through Chorus Pro (cf this page from the Ministry of Economy website. Chorus Pro accepts electronic invoices in Factur-X format in any of the 5 profiles. Chorus Pro also accepts electronic invoices in standards other than Factur-X.