Add codification of tax rates (#4372)

* draft

* .

* Rebase migration

* Update src/pretix/base/models/tax.py

Co-authored-by: Mira <weller@rami.io>

* Test, isort, flake, migration rebase

* carry data & API

* Fix failing tests

* docs fixes

* Improve validation

* Tests

* More fixes

---------

Co-authored-by: Mira <weller@rami.io>
This commit is contained in:
Raphael Michel
2024-12-13 12:04:38 +01:00
committed by GitHub
parent a4385c8b6e
commit 53f129d5d3
36 changed files with 818 additions and 124 deletions

View File

@@ -50,7 +50,7 @@ def item2(event2):
@pytest.fixture
def taxrule(event):
return event.tax_rules.create(rate=Decimal('19.00'))
return event.tax_rules.create(rate=Decimal('19.00'), code="S/standard")
@pytest.fixture
@@ -111,9 +111,9 @@ def order(event, item, device, taxrule, question):
amount=Decimal('23.00'),
)
o.fees.create(fee_type=OrderFee.FEE_TYPE_PAYMENT, value=Decimal('0.25'), tax_rate=Decimal('19.00'),
tax_value=Decimal('0.05'), tax_rule=taxrule)
tax_value=Decimal('0.05'), tax_rule=taxrule, tax_code=taxrule.code)
o.fees.create(fee_type=OrderFee.FEE_TYPE_PAYMENT, value=Decimal('0.25'), tax_rate=Decimal('19.00'),
tax_value=Decimal('0.05'), tax_rule=taxrule, canceled=True)
tax_value=Decimal('0.05'), tax_rule=taxrule, tax_code=taxrule.code, canceled=True)
InvoiceAddress.objects.create(order=o, company="Sample company", country=Country('NZ'),
vat_id="DE123", vat_id_validated=True, custom_field="Custom info")
op = OrderPosition.objects.create(
@@ -196,6 +196,7 @@ TEST_ORDERPOSITION_RES = {
"tax_rate": "0.00",
"tax_value": "0.00",
"tax_rule": None,
"tax_code": None,
"secret": "z3fsn8jyufm5kpk768q69gkbyr5f4h6w",
"addon_to": None,
"pseudonymization_id": "ABCDEFGHKL",
@@ -297,6 +298,7 @@ TEST_ORDER_RES = {
"description": "",
"internal_type": "",
"tax_rate": "19.00",
"tax_code": "S/standard",
"tax_value": "0.05"
}
],