Case study
2FacturaE: e-invoicing for the Spanish public administration from Dolibarr
Improvements to a Dolibarr module that generates Spain’s FacturaE e-invoice: an XML file ready to be signed and submitted to the public administration’s entry point.
- PHP
- Dolibarr
- XML
- FacturaE
The problem
Companies that invoice the Spanish public administration must do so with e-invoices in the FacturaE format: an XML file with a strict structure, full tax details for issuer and recipient and, often, an electronic signature. Building it by hand for every invoice is slow and error-prone, and a mistake means the administration rejects the invoice.
Starting point
2FacturaE is a 2byte module that has been in production for years, aimed especially at companies that work with the public sector. My work was improving it, working on my own on the existing module.
What it does
- FacturaE data on the customer: a dedicated tab on the customer record with person type (individual or company), residency type, names, and a public-administration flag with its DIR3 code.
- FacturaE data on the invoice: case number, the recipient’s contract and order references, legal notes, special tax regime and its justification, and delivery note.
- Invoice type: full, simplified or corrective.
- XML generation: one click creates the FacturaE file, downloadable from the invoice itself.
- Optional electronic signature: with a PFX certificate configured, a signed file is generated as well.
- VAT or IGIC: companies in the Canary Islands can invoice with IGIC instead of VAT.
- Mercantile registry details of the issuer included in the XML, and mapping between Dolibarr’s payment methods and FacturaE’s.
My role
I improved the existing module on my own; the version shown in the demo is the one that includes my work.