Adds report to view credit notes.

This commit is contained in:
Christopher Neugebauer 2016-09-02 10:40:28 +10:00
parent 499c4209cf
commit 372512c6af
2 changed files with 28 additions and 0 deletions

View file

@ -173,3 +173,30 @@ def inventory(request, form):
]) ])
return Report("Inventory", headings, data) 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)

View file

@ -38,6 +38,7 @@ public = [
reports = [ reports = [
url(r"^$", staff_views.reports_list, name="reports_list"), 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"^inventory/?$", staff_views.inventory, name="inventory"),
url(r"^items_sold/?$", staff_views.items_sold, name="items_sold"), url(r"^items_sold/?$", staff_views.items_sold, name="items_sold"),
] ]