Skip to content

Commit

Permalink
Order search: Add filter for pending without payment
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelm committed Jan 9, 2024
1 parent 8a155d5 commit 5b5e831
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/pretix/control/forms/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ class OrderFilterForm(FilterForm):
('partially_paid', _('Partially paid')),
('underpaid', _('Underpaid (but confirmed)')),
('pendingpaid', _('Pending (but fully paid)')),
('pendingnopayment', _('Pending (but no current payment)')),
)),
(_('Approval process'), (
('na', _('Approved, payment pending')),
Expand Down Expand Up @@ -327,6 +328,18 @@ def filter_qs(self, qs):
Q(status__in=(Order.STATUS_EXPIRED, Order.STATUS_PENDING)) & Q(pending_sum_t__lte=0)
& Q(require_approval=False)
)
elif s == 'pendingnopayment':
qs = qs.exclude(
Exists(
OrderPayment.objects.filter(
order=OuterRef('pk'),
state__in=(OrderPayment.PAYMENT_STATE_CREATED, OrderPayment.PAYMENT_STATE_PENDING)
)
)
).filter(
status=Order.STATUS_PENDING,
require_approval=False,
)
elif s == 'partially_paid':
qs = Order.annotate_overpayments(qs, refunds=False, results=False, sums=True)
qs = qs.filter(
Expand Down

0 comments on commit 5b5e831

Please sign in to comment.