mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-25 01:12:16 +00:00
Add a button for creating and instantly voiding invoices
Handy dandy for when you have loads of cancelled events, like say, a pandemic
This commit is contained in:
@@ -201,6 +201,11 @@ class InvoiceEvent(generic.View):
|
|||||||
invoice.invoice_date = datetime.date.today()
|
invoice.invoice_date = datetime.date.today()
|
||||||
messages.success(self.request, 'Invoice created successfully')
|
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}))
|
return HttpResponseRedirect(reverse_lazy('invoice_detail', kwargs={'pk': invoice.pk}))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -69,12 +69,15 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
<a href="{% url 'invoice_event' event.pk %}"
|
<div class="btn-group">
|
||||||
class="btn btn-primary"
|
<a href="{% url 'invoice_event' event.pk %}"
|
||||||
data-toggle="tooltip"
|
class="btn btn-primary">
|
||||||
title="'Invoice' this event - click this when paperwork has been sent to treasury">
|
<span class="fas fa-pound-sign"></span> Create Invoice
|
||||||
<i class="fas fa-pound-sign"></i> Paperwork Sent
|
</a>
|
||||||
</a>
|
<a href="{% url 'invoice_event_void' event.pk %}"
|
||||||
|
class="btn btn-warning">& Void
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
@@ -122,6 +122,8 @@ urlpatterns = [
|
|||||||
|
|
||||||
path('event/<int:pk>/invoice/', permission_required_with_403('RIGS.add_invoice')(finance.InvoiceEvent.as_view()),
|
path('event/<int:pk>/invoice/', permission_required_with_403('RIGS.add_invoice')(finance.InvoiceEvent.as_view()),
|
||||||
name='invoice_event'),
|
name='invoice_event'),
|
||||||
|
path('event/<int:pk>/invoice/void', permission_required_with_403('RIGS.add_invoice')(finance.InvoiceEvent.as_view()),
|
||||||
|
name='invoice_event_void', kwargs={'void': True}),
|
||||||
|
|
||||||
path('invoice/<int:pk>/', permission_required_with_403('RIGS.view_invoice')(finance.InvoiceDetail.as_view()),
|
path('invoice/<int:pk>/', permission_required_with_403('RIGS.view_invoice')(finance.InvoiceDetail.as_view()),
|
||||||
name='invoice_detail'),
|
name='invoice_detail'),
|
||||||
|
|||||||
Reference in New Issue
Block a user