heeplr [Thu, 27 Nov 2025 19:55:42 +0000 (20:55 +0100)]
Add official XRechnung schema (#91)
add official XRechnung schema from XRechnung Bundle 3.0.2 - https://xeinkauf.de/dokumente/
The filenames were prefixed with the drafthorse standard and include paths adapted accordingly.
was allowed but had no effect as payemnt_means is a container.
Now it gives:
Traceback (most recent call last):
File "/home/mdk/src/python-drafthorse/test.py", line 54, in <module>
doc.trade.settlement.payment_means.type_code = "30" # Virement
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Container' object has no attribute 'type_code' and no __dict__ for setting new attributes
heeplr [Thu, 27 Nov 2025 19:52:54 +0000 (20:52 +0100)]
Fix string handling of DecimalElement (#95)
* remove __str__() to ensure string type by falling back to inherited StringElement.__str__()
* wrap __format__ method of _value
* enforce Decimal() type in __init__
Hanno Böck [Sun, 6 Apr 2025 07:21:19 +0000 (09:21 +0200)]
Fix README example and remove unused "import os" (#76)
The example code in the README no longer works with the latest version.
A similar example in
https://github.com/pretix/python-drafthorse/blob/master/tests/conftest.py
exists, and uses a Decimal for
doc.trade.settlement.monetary_summation.tax_total
instead of a tuple.
Change README example to do that as well.
Marko Luther [Sun, 10 Mar 2024 15:47:25 +0000 (16:47 +0100)]
Add xml info to pdf metadata2 (#15)
* Bump to 2.3.0
* PR #7 Include XML information in PDF metadata (cmcproject)
* update mustang validator
* fixes fx:DocumentFileName / fx:DocumentType order
* remove `schemas/ZUGFeRD2p2_extension_schema.xmp` (replaced by `xmp_schema.py` generator)
* removes date and seller from pdf metadata subject to simplify the code and remove hard coded English language
* removes doc type date and seller from pdf metadata subject (incl. the restriction to documents of type 380) to simplify the code and remove hard coded English language
* remove unused (now) unused constant INVOICE_TYPE_CODE and avoid the use of use bare `except`
* removes failing "Invalid doc type! XML value for TypeCode shall be 380 for an invoice." test
* allows to supply explicit profile level and extends profile auto detection to cover XRECHNUNG
* minor code style improvements like lazy % formatting in logging functions (logging-fstring-interpolation)
* fixes style (black)
* tests of auto detecting a XRechnung v2 and v3 profiles
* blacking again
* tests for en16931 auto profile recognition and auto profile recognition failure
* black again
* typo
* allow users to set custom pdf metadata and the PDF language identifier used by PDF readers for blind people
* black
* spelling
* Update drafthorse/pdf.py
* Run black
---------
Co-authored-by: Raphael Michel <michel@rami.io> Co-authored-by: Raphael Michel <mail@raphaelmichel.de>
Marko Luther [Sun, 10 Mar 2024 15:28:48 +0000 (16:28 +0100)]
fixes Issue #20, Issue #22, Issue #26 and Issue #29. It replaces PR #21 and PR #23 and contains alignments to the v2.2 specification (#27)
* - corrects the NS_QDT name according to the zugferd22 specification
- extends elements.py:DateTimeElement to allow the adjustment of the inner DateTimes namespace
- updates references.py:ReferencedDocument to use NS_QDT for its DateTimeElement
- corrects profiles in reference.py for various attributes according to the zugferd22 schemata
- adds test zugferd_2p2_EN16931_ElektronischeAdresse2.xml as a variation of the official zugferd22 sample EN16931_ElektronischeAdresse.xml adding a FormattedIssueDateTime to the BuyerOrderReferencedDocument
- moves SellerOrderReferencedDocument from trade.py to references.py
- fixes DateTimeField namespace of AdvancePayment.received_date
* This commit also adds the class ProductInstance (IndividualTradeProductInstance) to product.py and adds the missing fields "id" (IDField) and "instance" (ProductInstance) to product.py:TradeProduct.
This commit also adds class PayerTradeParty (PayerTradeParty) to party.py and adds the missing field "payer" (PayerTradeParty) to trade.py:TradeSettlement.
This commit also removes the unused (and not needed) party.py:LineApplicableTradeTax class.
This commit also corrects profile and required tags according to the v2.2 specification as follows:
Marko Luther [Fri, 19 Jan 2024 17:12:14 +0000 (18:12 +0100)]
Corrects the attribute order of ApplicableTradeTax (#19)
* aligns the attribute order of the ApplicableTradeTax class to the TradeTaxType in FACTUR-X_EXTENDED_urn_un_unece_uncefact_data_standard_ReusableAggregateBusinessInformationEntity_100.xsd to fix https://github.com/pretix/python-drafthorse/issues/18