mirror of
https://github.com/pretix/pretix.git
synced 2026-05-10 16:04:02 +00:00
@@ -162,10 +162,12 @@ class Voucher(LoggedModel):
|
|||||||
|
|
||||||
def is_ordered(self) -> int:
|
def is_ordered(self) -> int:
|
||||||
"""
|
"""
|
||||||
Returns whether an order position exists that uses this voucher.
|
Returns whether a non-canceled order position exists that uses this voucher.
|
||||||
"""
|
"""
|
||||||
return OrderPosition.objects.filter(
|
return OrderPosition.objects.filter(
|
||||||
voucher=self
|
voucher=self
|
||||||
|
).exclude(
|
||||||
|
order__status=Order.STATUS_CANCELLED
|
||||||
).exists()
|
).exists()
|
||||||
|
|
||||||
def is_in_cart(self) -> int:
|
def is_in_cart(self) -> int:
|
||||||
|
|||||||
@@ -152,6 +152,11 @@ def cancel_order(order, user=None):
|
|||||||
if i:
|
if i:
|
||||||
generate_cancellation(i)
|
generate_cancellation(i)
|
||||||
|
|
||||||
|
for position in order.positions.all():
|
||||||
|
if position.voucher:
|
||||||
|
position.voucher.redeemed = False
|
||||||
|
position.voucher.save()
|
||||||
|
|
||||||
return order
|
return order
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user