Fix invalid handling of variations with quota-level vouchers

This commit is contained in:
Raphael Michel
2019-04-25 11:54:03 +02:00
parent 13bf975dd5
commit ef600ceddb
4 changed files with 81 additions and 1 deletions

View File

@@ -344,6 +344,8 @@ class Voucher(LoggedModel):
a variation).
"""
if self.quota_id:
if variation:
return variation.quotas.filter(pk=self.quota_id).exists()
return item.quotas.filter(pk=self.quota_id).exists()
if self.item_id and not self.variation_id:
return self.item_id == item.pk