Order list: Add filter for canceled with and without paid fee

This commit is contained in:
Raphael Michel
2019-02-13 18:06:09 +01:00
parent abb770a8e7
commit b3debdfb55

View File

@@ -207,10 +207,11 @@ class EventOrderFilterForm(OrderFilterForm):
(Order.STATUS_EXPIRED, _('Expired')),
(Order.STATUS_PENDING + Order.STATUS_EXPIRED, _('Pending or expired')),
(Order.STATUS_CANCELED, _('Canceled')),
('cp', _('Canceled (or with paid fee)')),
('pa', _('Approval pending')),
('overpaid', _('Overpaid')),
('underpaid', _('Underpaid')),
('pendingpaid', _('Pending (but fully paid)'))
('pendingpaid', _('Pending (but fully paid)')),
),
required=False,
)
@@ -297,6 +298,15 @@ class EventOrderFilterForm(OrderFilterForm):
status=Order.STATUS_PENDING,
require_approval=True
)
elif fdata.get('status') == 'cp':
s = OrderPosition.objects.filter(
order=OuterRef('pk')
)
qs = qs.annotate(
has_pc=Exists(s)
).filter(
Q(status=Order.STATUS_PAID, has_pc=False) | Q(status=Order.STATUS_CANCELED)
)
return qs