forked from CGM_Public/pretix_original
Allow to cancel expired orders
This commit is contained in:
@@ -426,7 +426,7 @@ class Order(LockModel, LoggedModel):
|
|||||||
|
|
||||||
def cancel_allowed(self):
|
def cancel_allowed(self):
|
||||||
return (
|
return (
|
||||||
self.status in (Order.STATUS_PENDING, Order.STATUS_PAID) and self.count_positions
|
self.status in (Order.STATUS_PENDING, Order.STATUS_PAID, Order.STATUS_EXPIRED) and self.count_positions
|
||||||
)
|
)
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
|
|||||||
@@ -294,8 +294,8 @@ def _cancel_order(order, user=None, send_mail: bool=True, api_token=None, device
|
|||||||
if not order.cancel_allowed():
|
if not order.cancel_allowed():
|
||||||
raise OrderError(_('You cannot cancel this order.'))
|
raise OrderError(_('You cannot cancel this order.'))
|
||||||
invoices = []
|
invoices = []
|
||||||
i = order.invoices.filter(is_cancellation=False, refered__isnull=True).last()
|
i = order.invoices.filter(is_cancellation=False).last()
|
||||||
if i:
|
if i and not i.refered.exists():
|
||||||
invoices.append(generate_cancellation(i))
|
invoices.append(generate_cancellation(i))
|
||||||
|
|
||||||
for position in order.positions.all():
|
for position in order.positions.all():
|
||||||
|
|||||||
Reference in New Issue
Block a user