summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexis de Lattre <alexis.delattre@akretion.com>2017-11-12 20:46:28 (GMT)
committerAlexis de Lattre <alexis.delattre@akretion.com>2017-11-12 20:46:28 (GMT)
commit3eaf3852cd9854bdf70d5ed7fb9d3145c01ae7d4 (patch)
tree1682f9eaf5b7fa1d09e893b3eb1daa04d5c579a7
parentad02c20c45d45e81b7ac0caf3462aa36eae66061 (diff)
downloadfactur-x-3eaf3852cd9854bdf70d5ed7fb9d3145c01ae7d4.zip
factur-x-3eaf3852cd9854bdf70d5ed7fb9d3145c01ae7d4.tar.gz
factur-x-3eaf3852cd9854bdf70d5ed7fb9d3145c01ae7d4.tar.bz2
Adapt to latest change in Factur-X URN
-rw-r--r--facturx/facturx.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/facturx/facturx.py b/facturx/facturx.py
index 97642fe..08995e0 100644
--- a/facturx/facturx.py
+++ b/facturx/facturx.py
@@ -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