diff --git a/RIGS/finance.py b/RIGS/finance.py index d0b9fffd..e6423e13 100644 --- a/RIGS/finance.py +++ b/RIGS/finance.py @@ -201,6 +201,11 @@ class InvoiceEvent(generic.View): invoice.invoice_date = datetime.date.today() messages.success(self.request, 'Invoice created successfully') + if kwargs.get('void'): + invoice.void = not invoice.void + invoice.save() + messages.warning(self.request, 'Invoice voided') + return HttpResponseRedirect(reverse_lazy('invoice_detail', kwargs={'pk': invoice.pk})) diff --git a/RIGS/templates/invoice_list_waiting.html b/RIGS/templates/invoice_list_waiting.html index 668e4a7e..db3a5e6e 100644 --- a/RIGS/templates/invoice_list_waiting.html +++ b/RIGS/templates/invoice_list_waiting.html @@ -69,12 +69,15 @@ {% endif %} - - Paperwork Sent - +
+ + Create Invoice + + & Void + +
{% endfor %} diff --git a/RIGS/urls.py b/RIGS/urls.py index b89cf771..c4f78c29 100644 --- a/RIGS/urls.py +++ b/RIGS/urls.py @@ -122,6 +122,8 @@ urlpatterns = [ path('event//invoice/', permission_required_with_403('RIGS.add_invoice')(finance.InvoiceEvent.as_view()), name='invoice_event'), + path('event//invoice/void', permission_required_with_403('RIGS.add_invoice')(finance.InvoiceEvent.as_view()), + name='invoice_event_void', kwargs={'void': True}), path('invoice//', permission_required_with_403('RIGS.view_invoice')(finance.InvoiceDetail.as_view()), name='invoice_detail'),