From 39d27d273050cec057b60ebef4d049713f971f06 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Sun, 10 Jul 2016 10:49:23 +0100 Subject: [PATCH] Basic invoice UI improvements - closes #232 --- RIGS/finance.py | 1 + RIGS/models.py | 4 +++ RIGS/templates/RIGS/event_detail.html | 42 +++++++++++++++++++------ RIGS/templates/RIGS/invoice_detail.html | 2 +- 4 files changed, 39 insertions(+), 10 deletions(-) diff --git a/RIGS/finance.py b/RIGS/finance.py index 75de8bd9..5cc5c0c1 100644 --- a/RIGS/finance.py +++ b/RIGS/finance.py @@ -144,6 +144,7 @@ class InvoiceEvent(generic.View): if created: invoice.invoice_date = datetime.date.today() + messages.success(self.request, 'Invoice created successfully') return HttpResponseRedirect(reverse_lazy('invoice_detail', kwargs={'pk': invoice.pk})) diff --git a/RIGS/models.py b/RIGS/models.py index 535aa42c..0650d81c 100644 --- a/RIGS/models.py +++ b/RIGS/models.py @@ -526,6 +526,10 @@ class Invoice(models.Model): def balance(self): return self.sum_total - self.payment_total + @property + def is_closed(self): + return self.balance == 0 or self.void + def __str__(self): return "%i: %s (%.2f)" % (self.pk, self.event, self.balance) diff --git a/RIGS/templates/RIGS/event_detail.html b/RIGS/templates/RIGS/event_detail.html index 81658663..d4b089a9 100644 --- a/RIGS/templates/RIGS/event_detail.html +++ b/RIGS/templates/RIGS/event_detail.html @@ -25,9 +25,17 @@ class="hidden-xs">Duplicate {% if event.is_rig %} {% if perms.RIGS.add_invoice %} - + + {% endif %} {% endif %} @@ -190,9 +198,17 @@ class="hidden-xs">Duplicate {% if event.is_rig %} {% if perms.RIGS.add_invoice %} - + + {% endif %} {% endif %} @@ -227,9 +243,17 @@ class="hidden-xs">Duplicate {% if event.is_rig %} {% if perms.RIGS.add_invoice %} - + + {% endif %} {% endif %} diff --git a/RIGS/templates/RIGS/invoice_detail.html b/RIGS/templates/RIGS/invoice_detail.html index ad177ba4..2973c358 100644 --- a/RIGS/templates/RIGS/invoice_detail.html +++ b/RIGS/templates/RIGS/invoice_detail.html @@ -38,7 +38,7 @@
-
+
Event Details