Do not allow customers to cancel checked-in orders

This commit is contained in:
Raphael Michel
2019-01-21 09:04:06 +01:00
parent cdea6eb55e
commit 3703fbcacf
2 changed files with 21 additions and 3 deletions

View File

@@ -15,7 +15,7 @@ from django.utils.timezone import now
from pretix.base.i18n import language
from pretix.base.models import (
CachedFile, CartPosition, CheckinList, Event, Item, ItemCategory,
CachedFile, CartPosition, Checkin, CheckinList, Event, Item, ItemCategory,
ItemVariation, Order, OrderFee, OrderPayment, OrderPosition, OrderRefund,
Organizer, Question, Quota, User, Voucher, WaitingListEntry,
)
@@ -865,6 +865,18 @@ class OrderTestCase(BaseQuotaTestCase):
self.event.settings.cancel_allow_user_paid = True
assert self.order.user_cancel_allowed
def test_can_cancel_checked_in(self):
self.order.status = Order.STATUS_PAID
self.order.save()
self.event.settings.cancel_allow_user = False
self.event.settings.cancel_allow_user_paid = True
assert self.order.user_cancel_allowed
Checkin.objects.create(
position=self.order.positions.first(),
list=CheckinList.objects.create(event=self.event, name='Default')
)
assert not self.order.user_cancel_allowed
def test_can_cancel_order_multiple(self):
item1 = Item.objects.create(event=self.event, name="Ticket", default_price=23,
admission=True, allow_cancel=True)