diff --git a/registrasion/staff_views.py b/registrasion/staff_views.py index a21e663b..6672bfba 100644 --- a/registrasion/staff_views.py +++ b/registrasion/staff_views.py @@ -173,3 +173,30 @@ def inventory(request, form): ]) return Report("Inventory", headings, data) + + +@report_view("Credit notes") +def credit_notes(request, form): + ''' Shows all of the credit notes in the system. ''' + + notes = commerce.CreditNote.objects.all().select_related( + "creditnoterefund", + "creditnoteapplication", + "invoice", + "invoice__user__attendee__attendeeprofilebase", + ) + + headings = [ + "id", "Owner", "Status", "Value", + ] + + data = [] + for note in notes: + data.append([ + note.id, + note.invoice.user.attendee.attendeeprofilebase.invoice_recipient(), + note.status, + note.value, + ]) + + return Report("Credit Notes", headings, data) diff --git a/registrasion/urls.py b/registrasion/urls.py index d051c277..8f7408da 100644 --- a/registrasion/urls.py +++ b/registrasion/urls.py @@ -38,6 +38,7 @@ public = [ reports = [ url(r"^$", staff_views.reports_list, name="reports_list"), + url(r"^credit_notes/?$", staff_views.credit_notes, name="credit_notes"), url(r"^inventory/?$", staff_views.inventory, name="inventory"), url(r"^items_sold/?$", staff_views.items_sold, name="items_sold"), ]