invoice-x / factur-x-ng

Python lib for Factur-X, the e-invoicing standard for France and Germany
Other
34 stars 8 forks source link

Support for UBL #36

Closed duskybomb closed 6 years ago

duskybomb commented 6 years ago

I have done some work on UBL, till now reading, editing of fields and export is working. @m3nu can you check it and tell what is missing and what should I do differently?

Issue #26

duskybomb commented 6 years ago

example:

from facturx import *
from datetime import datetime as dt

factx = FacturX('no_xml_invoice.pdf', 'ubl2-1', '2.1')
print(factx['date'])
factx['date'] = dt.now()
print(factx['date'])
factx['currency'] = 'INR'
print(factx['currency'])
m3nu commented 6 years ago

Why is the version number needed 2x? (2.1?)

Why are there so many new files?

duskybomb commented 6 years ago

Why is the version number needed 2x? (2.1?)

One way of doing UBL support is by having 2.0 and 2.1 as levels, but the problem with it is, they follow different XPaths for same fields (sometimes). For Example:

currency
        ubl2-0: //cac:PaymentMeans/cbc:CurrencyCode
        ubl2-1: //cbc:DocumentCurrencyCode

It's not suitable to use them as levels under a single standard UBL. Hence, the need of version number.

Why are there so many new files?

The UBL has two folders inside it's xsd folder: common and maindoc. Common contains files like CodeList_CurrencyCode_ISO_7_04.xsd and CodeList_LanguageCode_ISO_7_04.xsd through which it validates the xml. Common contains 12 and 14 such files for 2.0 and 2.1 respectively. Hence so many new files. I haven't tested it without those file, I should. Thanks for the pointer

duskybomb commented 6 years ago

I tried it without those files and it didn't work, hence, these files are needed.

m3nu commented 6 years ago

Passing on this one.