Don't check voucher quotas if they bypass quotas (#1070)

This commit is contained in:
Tobias Kunze
2018-11-06 11:01:05 +01:00
committed by Raphael Michel
parent 18cb29b425
commit e49061e28c

View File

@@ -240,6 +240,8 @@ class Voucher(LoggedModel):
def clean_quota_needs_checking(data, old_instance, item_changed, creating):
# We only need to check for quota on vouchers that are now blocking quota and haven't
# before (or have blocked a different quota before)
if data.get('allow_ignore_quota', False):
return False
if data.get('block_quota', False):
is_valid = data.get('valid_until') is None or data.get('valid_until') >= now()
if not is_valid: