-
Notifications
You must be signed in to change notification settings - Fork 31
Description
Hi,
first of all thanks for you awesome work!
I highly appreciate this library, as I can implement my own ZUGFeRD solution for my invoicing!
One thing I stumbled uppon:
If you have a few partial invoices and end up with a final one, you should provide references to the partial invoices in [BG-3] InvoiceReferencedDocument which is represendted by document.trade.settlement.invoice_referenced_document correct?
According to the spec, multiple references (0...unbounded) should be possible here, so invoice_referenced_document should be a MultiField, right?
I tried to change it and it seems to work fine (also the xml looks good so far) with one problem: TypeCode ends up giving me a validation issue as soon as I add it:
File "d:\Dev\inveasy\backend\.venv\Lib\site-packages\drafthorse\models\document.py", line 119, in serialize
xml = super().serialize(schema)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "d:\Dev\inveasy\backend\.venv\Lib\site-packages\drafthorse\models\elements.py", line 80, in serialize
def __setattr__(self, key, value):
^^^^^^^^^^^^^^^^^^^^^^^^
File "d:\Dev\inveasy\backend\.venv\Lib\site-packages\drafthorse\utils.py", line 21, in validate_xml
xml_root = etree.fromstring(xmlout, parser)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "src\\lxml\\etree.pyx", line 3307, in lxml.etree.fromstring
File "src\\lxml\\parser.pxi", line 1995, in lxml.etree._parseMemoryDocument
File "src\\lxml\\parser.pxi", line 1882, in lxml.etree._parseDoc
File "src\\lxml\\parser.pxi", line 1164, in lxml.etree._BaseParser._parseDoc
File "src\\lxml\\parser.pxi", line 633, in lxml.etree._ParserContext._handleParseResultDoc
File "src\\lxml\\parser.pxi", line 743, in lxml.etree._handleParseResult
File "src\\lxml\\parser.pxi", line 672, in lxml.etree._raiseParseError
File "<string>", line 0
lxml.etree.XMLSyntaxError: Element '{urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100}TypeCode': This element is not expected.
I couldn't really figure out why, since the schema for ReferencedDocumentType contains the TypeCode as child, and the created xml also looked fine to me when I debugged it. Since it's not indented, line 0 also doesn't really help.
It's not critical for me, but I still wanted to provide the feedback. Thanks again!
Best regards!