From bcacff2ee78a77d719dad0aa13c0905f4badf7da Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Mon, 14 Sep 2026 10:31:07 +0200 Subject: [PATCH] Voucher list: Add budget and budget used to CSV export (Z#23237857) (#6520) * Voucher list: Add budget and budget used to CSV export (Z#23237857) * Fix failing test --- src/pretix/control/views/vouchers.py | 6 ++++-- src/tests/control/test_vouchers.py | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/pretix/control/views/vouchers.py b/src/pretix/control/views/vouchers.py index 4a3cd07c9a..d28f46e278 100644 --- a/src/pretix/control/views/vouchers.py +++ b/src/pretix/control/views/vouchers.py @@ -144,7 +144,7 @@ class VoucherList(VoucherQueryMixin, PaginationMixin, EventPermissionRequiredMix headers = [ _('Voucher code'), _('Valid until'), _('Product'), _('Reserve quota'), _('Bypass quota'), _('Price effect'), _('Value'), _('Tag'), _('Redeemed'), _('Maximum usages'), _('Seat'), - _('Comment') + _('Comment'), _('Budget'), _('Budget used') ] writer.writerow(headers) @@ -170,7 +170,9 @@ class VoucherList(VoucherQueryMixin, PaginationMixin, EventPermissionRequiredMix str(v.redeemed), str(v.max_usages), str(v.seat) if v.seat else "", - str(v.comment) if v.comment else "" + str(v.comment) if v.comment else "", + str(v.budget) if v.budget is not None else "", + str(v.budget_used) if v.budget is not None else "", ] writer.writerow(row) diff --git a/src/tests/control/test_vouchers.py b/src/tests/control/test_vouchers.py index 586448cd1a..4769814a5e 100644 --- a/src/tests/control/test_vouchers.py +++ b/src/tests/control/test_vouchers.py @@ -128,9 +128,9 @@ class VoucherFormTest(SoupTestMixin, TransactionTestCase): doc = self.client.get('/control/event/%s/%s/vouchers/?download=yes' % (self.orga.slug, self.event.slug)) assert doc.content.decode().strip() == '"Voucher code","Valid until","Product","Reserve quota",' \ '"Bypass quota","Price effect","Value","Tag","Redeemed",' \ - '"Maximum usages","Seat","Comment"' \ + '"Maximum usages","Seat","Comment","Budget","Budget used"' \ '\r\n"ABCDEFG","","Early-bird ticket","No","No","No effect","","","0",' \ - '"1","",""' + '"1","","","",""' def test_filter_status_valid(self): with scopes_disabled():