Add a maximum budget to vouchers (#1526)

* Data model changes

* Fix test failures

* Adjustments

* Some tests and API support

* Check when extending orders

* Make things more deterministic, fix style

* Do not apply negative discounts

* Update price_before_voucher on item/subevent changes

* Add tests for price_before_voucher in combination with free price

* Fix InvoiceAddress.DoesNotExist
This commit is contained in:
Raphael Michel
2020-01-03 16:15:17 +01:00
committed by GitHub
parent b738e3bd9d
commit 8e2821b398
20 changed files with 649 additions and 23 deletions

View File

@@ -37,9 +37,11 @@ class VoucherList(PaginationMixin, EventPermissionRequiredMixin, ListView):
permission = 'can_view_vouchers'
def get_queryset(self):
qs = self.request.event.vouchers.filter(waitinglistentries__isnull=True).select_related(
qs = Voucher.annotate_budget_used_orders(self.request.event.vouchers.filter(
waitinglistentries__isnull=True
).select_related(
'item', 'variation', 'seat'
)
))
if self.filter_form.is_valid():
qs = self.filter_form.filter_qs(qs)