Add Invoice.fee_type, Invoice.fee_internal_type

This commit is contained in:
Raphael Michel
2021-06-22 16:58:22 +02:00
parent 8700c41f5e
commit cba2ad5333
7 changed files with 56 additions and 2 deletions

View File

@@ -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):

View File

@@ -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),
),
]

View File

@@ -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):

View File

@@ -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: