Skip to content
Snippets Groups Projects
Commit ef8256ee authored by Tom Teichler's avatar Tom Teichler :beers:
Browse files

Set price correct for event registration

parent 5f03d499
No related branches found
No related tags found
1 merge request!42Set price correct for event registration
Pipeline #130154 failed
# Generated by Django 3.2.19 on 2023-06-04 14:54
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('paweljong', '0022_send_to_retracted_or_not_checked_in'),
]
operations = [
migrations.AddField(
model_name='eventregistration',
name='cost',
field=models.IntegerField(blank=True, null=True, verbose_name='Cost in €'),
),
]
...@@ -309,6 +309,13 @@ class EventRegistration(ExtensibleModel): ...@@ -309,6 +309,13 @@ class EventRegistration(ExtensibleModel):
checked_in = models.BooleanField(verbose_name=_("Checked in"), default=False) checked_in = models.BooleanField(verbose_name=_("Checked in"), default=False)
checked_in_date = models.DateTimeField(verbose_name=_("Checked in at"), null=True, blank=True) checked_in_date = models.DateTimeField(verbose_name=_("Checked in at"), null=True, blank=True)
cost = models.IntegerField(verbose_name=_("Cost in €"), null=True, blank=True)
def save(self):
if not self.cost:
self.cost = self.event.cost
def mark_checked_in(self): def mark_checked_in(self):
if not self.checked_in: if not self.checked_in:
self.checked_in = True self.checked_in = True
...@@ -372,7 +379,7 @@ class EventRegistration(ExtensibleModel): ...@@ -372,7 +379,7 @@ class EventRegistration(ExtensibleModel):
yield PurchasedItem( yield PurchasedItem(
name=self.event.display_name, name=self.event.display_name,
quantity=1, quantity=1,
price=Decimal(self.event.cost / 1.07), price=Decimal(self.cost / 1.07),
currency="EUR", currency="EUR",
sku="EVENT", sku="EVENT",
tax_rate=7, tax_rate=7,
...@@ -394,7 +401,7 @@ class EventRegistration(ExtensibleModel): ...@@ -394,7 +401,7 @@ class EventRegistration(ExtensibleModel):
yield PurchasedItem( yield PurchasedItem(
name=_("Voucher / Granted discount"), name=_("Voucher / Granted discount"),
quantity=1, quantity=1,
price=Decimal(-1 * self.voucher.discount * (self.event.cost / 1.07) / 100), price=Decimal(-1 * self.voucher.discount * (self.cost / 1.07) / 100),
currency="EUR", currency="EUR",
sku="DISCO", sku="DISCO",
tax_rate=7, tax_rate=7,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment