Unknown element LineID when parsing Factur-X EXTENDED invoice with InvoiceReferencedDocument

Open Beginner friendly
#113 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
88/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
python
Domain
backend

Research direction

Start in drafthorse/models/references.py, reading InvoiceReferencedDocument and InvoiceSpecifiedReferencedDocument alongside LineBuyerOrderReferencedDocument and the other Line*ReferencedDocument classes. Run the project’s existing tests, then verify that the supplied Factur-X EXTENDED example parses without an unknown LineID error and that existing reference-document behavior remains intact.

Written by the indexing model from the issue text.

Description

Description

When parsing a valid Factur-X EXTENDED invoice with Document.parse(), the following error is raised:

TypeError: Unknown element {urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100}LineID

The XML is valid against the official Factur-X 1.0.8 EXTENDED XSD schema FACTUR-X_EXTENDED.xsd.

Example:

factur-x.xml

Root cause

In drafthorse/models/references.py, the classes InvoiceReferencedDocument (line 59) and InvoiceSpecifiedReferencedDocument (line 67) are missing the line_id field, although LineID is a valid optional sub-element according to the Factur-X EXTENDED specification.

All other Line*ReferencedDocument classes in the same file already define this field, e.g. LineBuyerOrderReferencedDocument (line 95):

class LineBuyerOrderReferencedDocument(ReferencedDocument):
    line_id = StringField(NS_RAM, "LineID", required=False, profile=COMFORT)
    ...
Dominant language
Python
Stars
178
Forks
39
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pretix/python-drafthorse

All issues in pretix/python-drafthorse

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.