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 %} - Invoice + + Invoice {% endif %} {% endif %} @@ -190,9 +198,17 @@ class="hidden-xs">Duplicate {% if event.is_rig %} {% if perms.RIGS.add_invoice %} - Invoice + + Invoice {% endif %} {% endif %} @@ -227,9 +243,17 @@ class="hidden-xs">Duplicate {% if event.is_rig %} {% if perms.RIGS.add_invoice %} - Invoice + + 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 @@