Adapt to latest change in Factur-X URN

This commit is contained in:
Alexis de Lattre 2017-11-12 21:46:28 +01:00
parent ad02c20c45
commit 3eaf3852cd
1 changed files with 5 additions and 0 deletions

View File

@ -419,6 +419,11 @@ def get_facturx_level(facturx_xml_etree):
"GuidelineSpecifiedDocumentContextParameter/ID.")
doc_id = doc_id_xpath[0].text
level = doc_id.split(':')[-1]
if level not in FACTURX_LEVEL2xmp:
level = doc_id.split(':')[-2]
if level not in FACTURX_LEVEL2xmp:
raise ValueError(
"Invalid Factur-X URN: '%s'" % doc_id)
logger.info('Factur-X level is %s (autodetected)', level)
return level