mirror of
https://github.com/pretix/pretix.git
synced 2026-08-09 10:37:50 +00:00
Add Invoice.fee_type, Invoice.fee_internal_type
This commit is contained in:
@@ -58,6 +58,15 @@ lines list of objects The actual invo
|
||||
created before this field was introduced as well as for
|
||||
all lines not created by a product (e.g. a shipping or
|
||||
cancellation fee).
|
||||
├ fee_type string Fee type, e.g. ``shipping``, ``service``, ``payment``,
|
||||
``cancellation``, ``giftcard``, or ``other. Can be ``null`` for
|
||||
all invoice lines
|
||||
created before this field was introduced as well as for
|
||||
all lines not created by a fee (e.g. a product).
|
||||
├ fee_internal_type string Additional fee type, e.g. type of payment provider. Can be ``null``
|
||||
for all invoice lines
|
||||
created before this field was introduced as well as for
|
||||
all lines not created by a fee (e.g. a product).
|
||||
├ event_date_from datetime Start date of the (sub)event this line was created for as it
|
||||
was set during invoice creation. Can be ``null`` for all invoice
|
||||
lines created before this was introduced as well as for lines in
|
||||
@@ -97,6 +106,10 @@ internal_reference string Customer's refe
|
||||
``lines.event_date_to``, and ``lines.attendee_name`` have been added.
|
||||
``refers`` now returns an invoice number including the prefix.
|
||||
|
||||
.. versionchanged:: 4.1
|
||||
|
||||
The attributes ``fee_type`` and ``fee_internal_type`` have been added.
|
||||
|
||||
|
||||
Endpoints
|
||||
---------
|
||||
@@ -162,6 +175,8 @@ Endpoints
|
||||
"description": "Budget Ticket",
|
||||
"item": 1234,
|
||||
"variation": 245,
|
||||
"fee_type": null,
|
||||
"fee_internal_type": null,
|
||||
"event_date_from": "2017-12-27T10:00:00Z",
|
||||
"event_date_to": null,
|
||||
"attendee_name": null,
|
||||
@@ -248,6 +263,8 @@ Endpoints
|
||||
"description": "Budget Ticket",
|
||||
"item": 1234,
|
||||
"variation": 245,
|
||||
"fee_type": null,
|
||||
"fee_internal_type": null,
|
||||
"event_date_from": "2017-12-27T10:00:00Z",
|
||||
"event_date_to": null,
|
||||
"attendee_name": null,
|
||||
|
||||
@@ -1425,7 +1425,8 @@ class InlineInvoiceLineSerializer(I18nAwareModelSerializer):
|
||||
class Meta:
|
||||
model = InvoiceLine
|
||||
fields = ('position', 'description', 'item', 'variation', 'attendee_name', 'event_date_from',
|
||||
'event_date_to', 'gross_value', 'tax_value', 'tax_rate', 'tax_name')
|
||||
'event_date_to', 'gross_value', 'tax_value', 'tax_rate', 'tax_name', 'fee_type',
|
||||
'fee_internal_type')
|
||||
|
||||
|
||||
class InvoiceSerializer(I18nAwareModelSerializer):
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
# Generated by Django 3.2.3 on 2021-06-22 14:57
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('pretixbase', '0194_membership_canceled'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='invoiceline',
|
||||
name='fee_internal_type',
|
||||
field=models.CharField(max_length=190, null=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='invoiceline',
|
||||
name='fee_type',
|
||||
field=models.CharField(max_length=190, null=True),
|
||||
),
|
||||
]
|
||||
@@ -343,6 +343,8 @@ class InvoiceLine(models.Model):
|
||||
item = models.ForeignKey('Item', null=True, blank=True, on_delete=models.PROTECT)
|
||||
variation = models.ForeignKey('ItemVariation', null=True, blank=True, on_delete=models.PROTECT)
|
||||
attendee_name = models.TextField(null=True, blank=True)
|
||||
fee_type = models.CharField(max_length=190, null=True, blank=True)
|
||||
fee_internal_type = models.CharField(max_length=190, null=True, blank=True)
|
||||
|
||||
@property
|
||||
def net_value(self):
|
||||
|
||||
@@ -244,7 +244,9 @@ def build_invoice(invoice: Invoice) -> Invoice:
|
||||
event_date_to=None if invoice.event.has_subevents else invoice.event.date_to,
|
||||
tax_value=fee.tax_value,
|
||||
tax_rate=fee.tax_rate,
|
||||
tax_name=fee.tax_rule.name if fee.tax_rule else ''
|
||||
tax_name=fee.tax_rule.name if fee.tax_rule else '',
|
||||
fee_type=fee.fee_type,
|
||||
fee_internal_type=fee.internal_type or None,
|
||||
)
|
||||
|
||||
if fee.tax_rule and fee.tax_rule.is_reverse_charge(ia) and fee.value and not fee.tax_value:
|
||||
|
||||
@@ -1024,6 +1024,8 @@ TEST_INVOICE_RES = {
|
||||
'attendee_name': 'Peter',
|
||||
'item': None,
|
||||
'variation': None,
|
||||
'fee_type': None,
|
||||
'fee_internal_type': None,
|
||||
"gross_value": "23.00",
|
||||
"tax_value": "0.00",
|
||||
"tax_name": "",
|
||||
@@ -1035,6 +1037,8 @@ TEST_INVOICE_RES = {
|
||||
'event_date_from': '2017-12-27T10:00:00Z',
|
||||
'event_date_to': None,
|
||||
'attendee_name': None,
|
||||
'fee_type': "payment",
|
||||
'fee_internal_type': None,
|
||||
'item': None,
|
||||
'variation': None,
|
||||
"gross_value": "0.25",
|
||||
@@ -4401,6 +4405,8 @@ def test_order_create_invoice(token_client, organizer, event, order):
|
||||
'description': 'Budget Ticket<br />Attendee: Peter',
|
||||
'event_date_from': '2017-12-27T10:00:00Z',
|
||||
'event_date_to': None,
|
||||
'fee_type': None,
|
||||
'fee_internal_type': None,
|
||||
'attendee_name': 'Peter',
|
||||
'item': pos.item_id,
|
||||
'variation': None,
|
||||
@@ -4414,6 +4420,8 @@ def test_order_create_invoice(token_client, organizer, event, order):
|
||||
'description': 'Payment fee',
|
||||
'event_date_from': '2017-12-27T10:00:00Z',
|
||||
'event_date_to': None,
|
||||
'fee_type': "payment",
|
||||
'fee_internal_type': None,
|
||||
'attendee_name': None,
|
||||
'item': None,
|
||||
'variation': None,
|
||||
|
||||
@@ -341,6 +341,7 @@ def test_positions(env):
|
||||
assert last.gross_value == fee.value
|
||||
assert last.tax_rate == fee.tax_rate
|
||||
assert last.tax_value == fee.tax_value
|
||||
assert last.fee_type == 'payment'
|
||||
assert inv.invoice_to == ""
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user