Voucher form: Fix quota check for partially redeemed vouchers

This commit is contained in:
Raphael Michel
2023-11-29 16:08:50 +01:00
parent b92feb382b
commit 82704b60c7
2 changed files with 15 additions and 0 deletions

View File

@@ -201,6 +201,8 @@ class VoucherForm(I18nModelForm):
cnt = len(data['codes']) * data.get('max_usages', 0)
else:
cnt = data.get('max_usages', 0)
if self.instance and self.instance.pk:
cnt -= self.instance.redeemed # these do not need quota any more
Voucher.clean_item_properties(
data, self.instance.event,