Skip to content

Conversation

@JulienPalard
Copy link
Contributor

@JulienPalard JulienPalard commented Nov 21, 2025

Before:

doc.trade.settlement.payment_means.type_code = "30"

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

It allowed to find issues in the tests, but they are fixed in #100 to avoid conflicts between those two PRs:

There as a:

doc.trade.settlement.payment_means.type_code = "ZZZ"

Instead of:

doc.trade.settlement.payment_means.add(PaymentMeans(type_code="ZZZ"))

And there was a:

doc.trade.settlement.advance_payment.received_date = datetime.now(timezone.utc)

Instead of:

advance = AdvancePayment(
    received_date=datetime.now(timezone.utc), paid_amount=Decimal(42)
)
advance.included_trade_tax.add(
    IncludedTradeTax(
        calculated_amount=Decimal(0),
        type_code="VAT",
        category_code="E",
        rate_applicable_percent=Decimal(0),
    )
)
doc.trade.settlement.advance_payment.add(advance)

JulienPalard added a commit to JulienPalard/python-drafthorse that referenced this pull request Nov 21, 2025
JulienPalard added a commit to JulienPalard/python-drafthorse that referenced this pull request Nov 21, 2025
Before:

    doc.trade.settlement.payment_means.type_code = "30"

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
@JulienPalard JulienPalard force-pushed the avoid-unimplemented-attrs-on-containers branch from 1cb0579 to 4c04eae Compare November 21, 2025 16:44
JulienPalard added a commit to JulienPalard/python-drafthorse that referenced this pull request Nov 21, 2025
@raphaelm raphaelm merged commit 8ae3f59 into pretix:master Nov 27, 2025
0 of 3 checks passed
@hartwork
Copy link
Contributor

@raphaelm git bisect shows that merging this broke CI.

hartwork added a commit to hartwork/python-drafthorse-fork that referenced this pull request Nov 27, 2025
raphaelm added a commit that referenced this pull request Nov 27, 2025
…103)

* Make README example pass validation with EN16931.

* Avoid copy/pasting the README example, it's too easily out of sync.

* Apply fixes from #102.

* Alternative implementation using cog.

* Run black

---------

Co-authored-by: Raphael Michel <michel@rami.io>
@hartwork
Copy link
Contributor

red_ci

Why?!

@JulienPalard JulienPalard deleted the avoid-unimplemented-attrs-on-containers branch November 27, 2025 20:49
@JulienPalard
Copy link
Contributor Author

Why?!

The old README had an invalid line:

doc.trade.settlement.payment_means.type_code = "ZZZ"

This invalid line is detected by this PR, making the CI fail.

But I had another PR to fix the README that has been merged too, with:

doc.trade.settlement.payment_means.add(PaymentMeans(type_code="ZZZ"))

@hartwork
Copy link
Contributor

@JulienPalard thanks for elaborating 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants