Skip to content

Commit

Permalink
account_invoice_factur-x: Add support for Factur-X standard instead o…
Browse files Browse the repository at this point in the history
…f ZUGFeRD
  • Loading branch information
alexis-via committed Jul 9, 2017
1 parent 8073d3d commit 2fd4ad4
Show file tree
Hide file tree
Showing 6 changed files with 613 additions and 89 deletions.
8 changes: 3 additions & 5 deletions account_invoice_factur-x/README.rst
Expand Up @@ -6,14 +6,12 @@
Account Invoice Factur-X
========================

With this module, the PDF customer invoices and refunds generated by the Qweb reporting engine of Odoo will comply with the `ZUGFeRD <http://www.pdflib.com/knowledge-base/pdfa/zugferd-invoices/>`_ standard at *Comfort* level and will soon comply with the Factur-X standard (the new e-invoicing standard for France and Germany which will be released in Q2 2017). The ZUGFeRD standard is a standard based on `CII <http://tfig.unece.org/contents/cross-industry-invoice-cii.htm>`_ (Cross-Industry Invoice) for electronic invoicing. The great idea of the ZUGFeRD standard is to embed an XML file inside the PDF invoice to carry structured information about the invoice. So, with a ZUGFeRD PDF invoice :
With this module, the PDF customer invoices and refunds generated by the Qweb reporting engine of Odoo will comply with the `Factur-X <http://fnfe-mpe.org/factur-x/>`_ standard at *EN 16931* level. The Factur-X standard is the new e-invoicing standard for France and Germany released in Beta version in July 2017. It should replace the `ZUGFeRD <http://www.pdflib.com/knowledge-base/pdfa/zugferd-invoices/>`_ standard which was a German standard. Those standards are based on `CII <http://tfig.unece.org/contents/cross-industry-invoice-cii.htm>`_ (Cross-Industry Invoice) for electronic invoicing. The great idea of the ZUGFeRD/Factur-X standard is to embed an XML file inside the PDF invoice to carry structured information about the invoice. So, with a ZUGFeRD/Factur-X PDF invoice:

* no need to change your habbits and those of your customers: you can still send your PDF invoices by email as usual.
* customers equiped with a modern accouting software will be able to import the invoice automatically as supplier invoice by taking advantage of the embedded XML file,
* customers with an ancient accounting software will just open the PDF file with their PDF reader and manually encode the document as supplier invoice in their accounting software.

The PDF invoices generated by this module have been validated by the `ZUGFeRD eInvoice validation portal <https://www.din-zugferd-validation.org>`_ and the validation system says that the invoices have 0 errors.

Installation
============

Expand All @@ -31,7 +29,7 @@ You just need to do the configuration of the module *base_zugferd* (see the desc
Usage
=====

On the form view of a customer invoice/refund, just click on the *Print* button as usual to get the ZUGFeRD-compliant PDF file.
On the form view of a customer invoice/refund, just click on the *Print* button as usual to get the Factur-X-compliant PDF file.

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
Expand All @@ -40,7 +38,7 @@ On the form view of a customer invoice/refund, just click on the *Print* button
Known issues / Roadmap
======================

* Add a hook in the _run_wkhtmltopdf() of the report module to embed the XML file inside the PDF file just after its generation and before it is saved as attachment (and do the same for the report_aeroo module) and try to have the related pull request accepted in Odoo. The current inherit of the get_pdf() is not good because it is not called when selecting the invoice from the attachment. In the meantime, you should always use the *Print Invoice* button to have a ZUGFeRD compliant file.
* Add a hook in the _run_wkhtmltopdf() of the report module to embed the XML file inside the PDF file just after its generation and before it is saved as attachment (and do the same for the report_aeroo module) and try to have the related pull request accepted in Odoo. The current inherit of the get_pdf() is not good because it is not called when selecting the invoice from the attachment. In the meantime, you should always use the *Print Invoice* button to have a Factur-X compliant file.

* develop glue modules (or use hasattr() ?) to add to the XML file pieces of information that is carried out by fields defined in other modules such as sale or stock (customer order reference, incoterms, delivery address, etc...).

Expand Down
20 changes: 20 additions & 0 deletions account_invoice_factur-x/data/Factur-X_EN16931.xsd
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:rsm="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:100"
xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100"
xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"
targetNamespace="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100"
elementFormDefault="qualified">
<xs:import namespace="urn:un:unece:uncefact:data:standard:QualifiedDataType:100" schemaLocation="Factur-X_EN16931_urn_un_unece_uncefact_data_standard_QualifiedDataType_100.xsd"/>
<xs:import namespace="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100" schemaLocation="Factur-X_EN16931_urn_un_unece_uncefact_data_standard_ReusableAggregateBusinessInformationEntity_100.xsd"/>
<xs:import namespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100" schemaLocation="Factur-X_EN16931_urn_un_unece_uncefact_data_standard_UnqualifiedDataType_100.xsd"/>
<xs:element name="CrossIndustryInvoice" type="rsm:CrossIndustryInvoiceType"/>
<xs:complexType name="CrossIndustryInvoiceType">
<xs:sequence>
<xs:element name="ExchangedDocumentContext" type="ram:ExchangedDocumentContextType"/>
<xs:element name="ExchangedDocument" type="ram:ExchangedDocumentType"/>
<xs:element name="SupplyChainTradeTransaction" type="ram:SupplyChainTradeTransactionType"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:100"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"
targetNamespace="urn:un:unece:uncefact:data:standard:QualifiedDataType:100"
elementFormDefault="qualified"
version="100.D16B">
<xs:import namespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100" schemaLocation="Factur-X_EN16931_urn_un_unece_uncefact_data_standard_UnqualifiedDataType_100.xsd"/>
<xs:simpleType name="AllowanceChargeReasonCodeContentType">
<xs:restriction base="xs:token"/>
</xs:simpleType>
<xs:complexType name="AllowanceChargeReasonCodeType">
<xs:simpleContent>
<xs:extension base="qdt:AllowanceChargeReasonCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="CountryIDContentType">
<xs:restriction base="xs:token"/>
</xs:simpleType>
<xs:complexType name="CountryIDType">
<xs:simpleContent>
<xs:extension base="qdt:CountryIDContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="CurrencyCodeContentType">
<xs:restriction base="xs:token"/>
</xs:simpleType>
<xs:complexType name="CurrencyCodeType">
<xs:simpleContent>
<xs:extension base="qdt:CurrencyCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="DocumentCodeContentType">
<xs:restriction base="xs:token"/>
</xs:simpleType>
<xs:complexType name="DocumentCodeType">
<xs:simpleContent>
<xs:extension base="qdt:DocumentCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="FormattedDateTimeFormatContentType">
<xs:restriction base="xs:string"/>
</xs:simpleType>
<xs:complexType name="FormattedDateTimeType">
<xs:sequence>
<xs:element name="DateTimeString">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="format" type="qdt:FormattedDateTimeFormatContentType"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:simpleType name="PaymentMeansCodeContentType">
<xs:restriction base="xs:token"/>
</xs:simpleType>
<xs:complexType name="PaymentMeansCodeType">
<xs:simpleContent>
<xs:extension base="qdt:PaymentMeansCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="ReferenceCodeContentType">
<xs:restriction base="xs:token"/>
</xs:simpleType>
<xs:complexType name="ReferenceCodeType">
<xs:simpleContent>
<xs:extension base="qdt:ReferenceCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="TaxCategoryCodeContentType">
<xs:restriction base="xs:token"/>
</xs:simpleType>
<xs:complexType name="TaxCategoryCodeType">
<xs:simpleContent>
<xs:extension base="qdt:TaxCategoryCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="TaxTypeCodeContentType">
<xs:restriction base="xs:token"/>
</xs:simpleType>
<xs:complexType name="TaxTypeCodeType">
<xs:simpleContent>
<xs:extension base="qdt:TaxTypeCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="TimeReferenceCodeContentType">
<xs:restriction base="xs:token"/>
</xs:simpleType>
<xs:complexType name="TimeReferenceCodeType">
<xs:simpleContent>
<xs:extension base="qdt:TimeReferenceCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
</xs:schema>

0 comments on commit 2fd4ad4

Please sign in to comment.