Add badge to nav for number of waiting invoices

Might slightly help us stop leaving them waiting for far too long...
This commit is contained in:
2021-08-05 11:36:45 +01:00
parent 673bee4215
commit 3322a5ddf8
6 changed files with 27 additions and 25 deletions

View File

@@ -179,24 +179,7 @@ class InvoiceWaiting(generic.ListView):
return context
def get_queryset(self):
return self.get_objects()
def get_objects(self):
# TODO find a way to select items
events = self.model.objects.filter(
(
Q(start_date__lte=datetime.date.today(), end_date__isnull=True) | # Starts before with no end
Q(end_date__lte=datetime.date.today()) # Has end date, finishes before
) & Q(invoice__isnull=True) & # Has not already been invoiced
Q(is_rig=True) # Is a rig (not non-rig)
).order_by('start_date') \
.select_related('person',
'organisation',
'venue', 'mic') \
.prefetch_related('items')
return events
return self.model.objects.waiting_invoices()
class InvoiceEvent(generic.View):