Date: Thu, 7 Apr 2016 00:52:33 +0100
Subject: [PATCH 011/120] Make 'created' noun class-specific. Closes #185
---
RIGS/templates/RIGS/activity_table.html | 2 +-
RIGS/templates/RIGS/version_history.html | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/RIGS/templates/RIGS/activity_table.html b/RIGS/templates/RIGS/activity_table.html
index 1d491663..049e9aad 100644
--- a/RIGS/templates/RIGS/activity_table.html
+++ b/RIGS/templates/RIGS/activity_table.html
@@ -72,7 +72,7 @@
| {{ version.revision.user.name }} |
{% if version.old == None %}
- Object Created
+ {{object|to_class_name}} Created
{% else %}
{% include 'RIGS/version_changes.html' %}
{% endif %} |
diff --git a/RIGS/templates/RIGS/version_history.html b/RIGS/templates/RIGS/version_history.html
index 924ea148..3261c5df 100644
--- a/RIGS/templates/RIGS/version_history.html
+++ b/RIGS/templates/RIGS/version_history.html
@@ -47,7 +47,7 @@
{{ version.revision.user.name }} |
{% if version.old == None %}
- Object Created
+ {{object|to_class_name}} Created
{% else %}
{% include 'RIGS/version_changes.html' %}
{% endif %}
From 767b5512e312d7b152c3a8a866146d47c07a07ed Mon Sep 17 00:00:00 2001
From: David Taylor
Date: Thu, 7 Apr 2016 00:53:57 +0100
Subject: [PATCH 012/120] Fail, missed a change, actually closes #185 now
---
RIGS/templates/RIGS/activity_table.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/RIGS/templates/RIGS/activity_table.html b/RIGS/templates/RIGS/activity_table.html
index 049e9aad..1a1c8c1d 100644
--- a/RIGS/templates/RIGS/activity_table.html
+++ b/RIGS/templates/RIGS/activity_table.html
@@ -72,7 +72,7 @@
| {{ version.revision.user.name }} |
{% if version.old == None %}
- {{object|to_class_name}} Created
+ {{version.new|to_class_name}} Created
{% else %}
{% include 'RIGS/version_changes.html' %}
{% endif %} |
From f8a2a7a9593bc63a8922fa9200d096f9b3ca5325 Mon Sep 17 00:00:00 2001
From: David Taylor
Date: Thu, 7 Apr 2016 09:23:35 +0100
Subject: [PATCH 013/120] Made items display in version history again
---
RIGS/versioning.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/RIGS/versioning.py b/RIGS/versioning.py
index 718bcf95..ee3da1d8 100644
--- a/RIGS/versioning.py
+++ b/RIGS/versioning.py
@@ -119,12 +119,12 @@ def compare_event_items(old, new):
# Build some dicts of what we have
item_dict = {} # build a list of items, key is the item_pk
for version in old_item_versions: # put all the old versions in a list
- if version.object_version.object.event.id == old.object_id:
+ if version.object_version.object.event.id == old.object_id_int:
compare = ItemCompare(old=version.object_version.object)
item_dict[version.object_id] = compare
for version in new_item_versions: # go through the new versions
- if version.object_version.object.event.id == new.object_id:
+ if version.object_version.object.event.id == new.object_id_int:
try:
compare = item_dict[version.object_id] # see if there's a matching old version
compare.new = version.object_version.object # then add the new version to the dictionary
From 98f28aaafd0a5756f5346abacbaecc45529ade36 Mon Sep 17 00:00:00 2001
From: David Taylor
Date: Tue, 12 Apr 2016 20:15:13 +0100
Subject: [PATCH 014/120] Based on has name as well as MIC - Fix #224
---
RIGS/templates/RIGS/event_detail.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/RIGS/templates/RIGS/event_detail.html b/RIGS/templates/RIGS/event_detail.html
index e68e73bf..81658663 100644
--- a/RIGS/templates/RIGS/event_detail.html
+++ b/RIGS/templates/RIGS/event_detail.html
@@ -151,7 +151,7 @@
{% if object.based_on.is_rig %}N{{ object.based_on.pk|stringformat:"05d" }}{% else %}
{{ object.based_on.pk }}{% endif %}
- {{ object.base_on.name }} {% if object.based_on.mic %}by {{ object.based_on.mic.name }}{% endif %}
+ {{ object.based_on.name }} {% if object.based_on.mic %}by {{ object.based_on.mic.name }}{% endif %}
{% endif %}
From 29aa13316df95eaab7ab1af9d85e0a73dcd774b5 Mon Sep 17 00:00:00 2001
From: David Taylor
Date: Wed, 27 Apr 2016 20:49:42 +0100
Subject: [PATCH 015/120] Fix for versioning when event has been deleted,
closes #226
---
RIGS/versioning.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/RIGS/versioning.py b/RIGS/versioning.py
index ee3da1d8..6d524fc0 100644
--- a/RIGS/versioning.py
+++ b/RIGS/versioning.py
@@ -119,12 +119,12 @@ def compare_event_items(old, new):
# Build some dicts of what we have
item_dict = {} # build a list of items, key is the item_pk
for version in old_item_versions: # put all the old versions in a list
- if version.object_version.object.event.id == old.object_id_int:
+ if version.field_dict["event"] == old.object_id_int:
compare = ItemCompare(old=version.object_version.object)
item_dict[version.object_id] = compare
for version in new_item_versions: # go through the new versions
- if version.object_version.object.event.id == new.object_id_int:
+ if version.field_dict["event"] == new.object_id_int:
try:
compare = item_dict[version.object_id] # see if there's a matching old version
compare.new = version.object_version.object # then add the new version to the dictionary
From ef815360663034e03948dc75ae4c5d43780fd1be Mon Sep 17 00:00:00 2001
From: Tom Price
Date: Thu, 19 May 2016 14:21:21 +0100
Subject: [PATCH 016/120] Add tooltips to rig type selectors. Closes #227
---
RIGS/templates/RIGS/event_form.html | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/RIGS/templates/RIGS/event_form.html b/RIGS/templates/RIGS/event_form.html
index 0e7aa6ad..0b855f17 100644
--- a/RIGS/templates/RIGS/event_form.html
+++ b/RIGS/templates/RIGS/event_form.html
@@ -29,9 +29,9 @@
}
function setTime02Hours() {
- var id_start = "{{ form.start_date.id_for_label }}"
- var id_end_date = "{{ form.end_date.id_for_label }}"
- var id_end_time = "{{ form.end_time.id_for_label }}"
+ var id_start = "{{ form.start_date.id_for_label }}";
+ var id_end_date = "{{ form.end_date.id_for_label }}";
+ var id_end_time = "{{ form.end_time.id_for_label }}";
if ($('#'+id_start).val() == $('#'+id_end_date).val()) {
var end_date = new Date($('#'+id_end_date).val());
end_date.setDate(end_date.getDate() + 1);
@@ -67,7 +67,7 @@
$('#{{form.is_rig.auto_id}}').prop('checked', false);
$('.form-is_rig').slideUp();
}
- })
+ });
{% endif %}
function supportsDate() {
@@ -106,7 +106,7 @@
});
}
- })
+ });
$(document).ready(function () {
setupItemTable($("#{{ form.items_json.id_for_label }}").val());
@@ -150,10 +150,12 @@
From a48afb91573d9bb59c03c8323786a462f3982d22 Mon Sep 17 00:00:00 2001
From: David Taylor
Date: Sun, 29 May 2016 22:56:58 +0100
Subject: [PATCH 036/120] Added internal/external indicators to invoice lists
---
RIGS/templates/RIGS/event_invoice.html | 5 +++++
RIGS/templates/RIGS/invoice_list.html | 7 ++++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/RIGS/templates/RIGS/event_invoice.html b/RIGS/templates/RIGS/event_invoice.html
index 94d84f04..79098853 100644
--- a/RIGS/templates/RIGS/event_invoice.html
+++ b/RIGS/templates/RIGS/event_invoice.html
@@ -57,9 +57,14 @@
{% if object.organisation %}
{{ object.organisation.name }}
+
+ {{ object.organisation.union_account|yesno:'Internal,External' }}
{% else %}
{{ object.person.name }}
+
+ External
{% endif %}
+
|
{{ object.sum_total|floatformat:2 }} |
diff --git a/RIGS/templates/RIGS/invoice_list.html b/RIGS/templates/RIGS/invoice_list.html
index cb63b7f5..f7d23fcf 100644
--- a/RIGS/templates/RIGS/invoice_list.html
+++ b/RIGS/templates/RIGS/invoice_list.html
@@ -33,9 +33,14 @@
|
{% if object.organisation %}
{{ object.event.organisation.name }}
+
+ {{ object.organisation.union_account|yesno:'Internal,External' }}
{% else %}
{{ object.event.person.name }}
- {% endif %} |
+
+ External
+ {% endif %}
+ |
{{ object.event.start_date }} |
{{ object.invoice_date }} |
{{ object.balance|floatformat:2 }} |
From 5cc69cbb413ac1adbc615f324cfed28f27ea5f31 Mon Sep 17 00:00:00 2001
From: David Taylor
Date: Sun, 29 May 2016 23:03:41 +0100
Subject: [PATCH 037/120] Stopped things opening in a new window, because it's
really annoying. If you want to do this, use the appropriate keyboard
shortcut or mouse button
---
RIGS/templates/RIGS/event_invoice.html | 4 ++--
RIGS/templates/RIGS/invoice_list.html | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/RIGS/templates/RIGS/event_invoice.html b/RIGS/templates/RIGS/event_invoice.html
index 79098853..0e56158f 100644
--- a/RIGS/templates/RIGS/event_invoice.html
+++ b/RIGS/templates/RIGS/event_invoice.html
@@ -50,7 +50,7 @@
danger
{% endif %}
">
- N{{ object.pk|stringformat:"05d" }}
+ | N{{ object.pk|stringformat:"05d" }}
{{ object.get_status_display }} |
{{ object.start_date }} |
{{ object.name }} |
@@ -76,7 +76,7 @@
{% endif %}
-
+
|
diff --git a/RIGS/templates/RIGS/invoice_list.html b/RIGS/templates/RIGS/invoice_list.html
index f7d23fcf..f833b89a 100644
--- a/RIGS/templates/RIGS/invoice_list.html
+++ b/RIGS/templates/RIGS/invoice_list.html
@@ -28,7 +28,7 @@
{% for object in object_list %}
| {{ object.pk }} |
- N{{ object.event.pk|stringformat:"05d" }}: {{ object.event.name }}
+ | N{{ object.event.pk|stringformat:"05d" }}: {{ object.event.name }}
{{ object.event.get_status_display }} |
{% if object.organisation %}
From 68b35c2d249763f9d5e60a717f9629ebabe6b226 Mon Sep 17 00:00:00 2001
From: David Taylor
Date: Sun, 29 May 2016 23:47:56 +0100
Subject: [PATCH 038/120] Removed print button conditions following discussion
---
RIGS/templates/RIGS/invoice_detail.html | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/RIGS/templates/RIGS/invoice_detail.html b/RIGS/templates/RIGS/invoice_detail.html
index e5b14a7f..ad177ba4 100644
--- a/RIGS/templates/RIGS/invoice_detail.html
+++ b/RIGS/templates/RIGS/invoice_detail.html
@@ -15,12 +15,10 @@
Void
- {% if not object.event.organisation.union_account %}
- Print
-
- {% endif %}
+ Print
+
From 9108cb3c4e264b38455b99c57b35deb0398912dc Mon Sep 17 00:00:00 2001
From: David Taylor
Date: Sat, 4 Jun 2016 18:08:43 +0100
Subject: [PATCH 039/120] Fail! Hide non-rigs from waiting invoices
---
RIGS/finance.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/RIGS/finance.py b/RIGS/finance.py
index be52b1f1..1fd9b535 100644
--- a/RIGS/finance.py
+++ b/RIGS/finance.py
@@ -124,6 +124,7 @@ class InvoiceWaiting(generic.ListView):
Q(start_date__lte=datetime.date.today(), end_date__isnull=True) | # Starts before with no end
Q(end_date__lte=datetime.date.today()) # Has end date, finishes before
) & Q(invoice__isnull=True) # Has not already been invoiced
+ & Q(is_rig=True) # Is a rig (not non-rig)
).order_by('start_date') \
.select_related('person',
From f92f418bc5cff671930a52bdab319cc8704553c1 Mon Sep 17 00:00:00 2001
From: David Taylor
Date: Mon, 6 Jun 2016 23:06:30 +0100
Subject: [PATCH 040/120] Fixed waiting invoice counter - closes #239
---
RIGS/finance.py | 1 +
RIGS/templates/RIGS/event_invoice.html | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/RIGS/finance.py b/RIGS/finance.py
index 1fd9b535..75de8bd9 100644
--- a/RIGS/finance.py
+++ b/RIGS/finance.py
@@ -112,6 +112,7 @@ class InvoiceWaiting(generic.ListView):
for obj in self.get_objects():
total += obj.sum_total
context['total'] = total
+ context['count'] = len(self.get_objects())
return context
def get_queryset(self):
diff --git a/RIGS/templates/RIGS/event_invoice.html b/RIGS/templates/RIGS/event_invoice.html
index 0e56158f..3136fe40 100644
--- a/RIGS/templates/RIGS/event_invoice.html
+++ b/RIGS/templates/RIGS/event_invoice.html
@@ -15,7 +15,7 @@
{% block content %}
- Events for Invoice ({{object_list|length}} Events, £ {{ total|floatformat:2 }})
+ Events for Invoice ({{count}} Events, £ {{ total|floatformat:2 }})
These events have happened, but paperwork has not yet been sent to treasury
{% if is_paginated %}
From 1163b117e4020421b0b4ce33f7abec330c8a5505 Mon Sep 17 00:00:00 2001
From: David Taylor
Date: Tue, 14 Jun 2016 19:23:40 +0100
Subject: [PATCH 041/120] Fixed #240
---
RIGS/templates/RIGS/invoice_list.html | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/RIGS/templates/RIGS/invoice_list.html b/RIGS/templates/RIGS/invoice_list.html
index f833b89a..7b080897 100644
--- a/RIGS/templates/RIGS/invoice_list.html
+++ b/RIGS/templates/RIGS/invoice_list.html
@@ -31,10 +31,10 @@
N{{ object.event.pk|stringformat:"05d" }}: {{ object.event.name }}
{{ object.event.get_status_display }} |
|
- {% if object.organisation %}
+ | {% if object.event.organisation %}
{{ object.event.organisation.name }}
- {{ object.organisation.union_account|yesno:'Internal,External' }}
+ {{ object.event.organisation.union_account|yesno:'Internal,External' }}
{% else %}
{{ object.event.person.name }}
From f265da2f1d9277a404c849d1004fb7a2907c6df0 Mon Sep 17 00:00:00 2001
From: David Taylor
Date: Tue, 14 Jun 2016 19:45:45 +0100
Subject: [PATCH 042/120] Fixed #241 and #244
---
RIGS/templates/RIGS/event_invoice.html | 124 +++++++++++++------------
RIGS/templates/RIGS/invoice_list.html | 82 ++++++++--------
2 files changed, 105 insertions(+), 101 deletions(-)
diff --git a/RIGS/templates/RIGS/event_invoice.html b/RIGS/templates/RIGS/event_invoice.html
index 3136fe40..05b351aa 100644
--- a/RIGS/templates/RIGS/event_invoice.html
+++ b/RIGS/templates/RIGS/event_invoice.html
@@ -22,68 +22,70 @@
{% paginator %}
{% endif %}
-
-
-
- | # |
- Start Date |
- Event Name |
- Client |
- Cost |
- MIC |
- |
-
-
-
- {% for object in object_list %}
-
- N{{ object.pk|stringformat:"05d" }}
- {{ object.get_status_display }} |
- {{ object.start_date }} |
- {{ object.name }} |
-
- {% if object.organisation %}
- {{ object.organisation.name }}
-
- {{ object.organisation.union_account|yesno:'Internal,External' }}
- {% else %}
- {{ object.person.name }}
-
- External
- {% endif %}
-
- |
- {{ object.sum_total|floatformat:2 }} |
-
- {% if object.mic %}
- {{ object.mic.initials }}
-
- {% else %}
-
- {% endif %}
- |
-
-
-
-
- |
+
+
+
+
+ | # |
+ Start Date |
+ Event Name |
+ Client |
+ Cost |
+ MIC |
+ |
- {% endfor %}
-
-
+
+
+ {% for object in object_list %}
+
+ N{{ object.pk|stringformat:"05d" }}
+ {{ object.get_status_display }} |
+ {{ object.start_date }} |
+ {{ object.name }} |
+
+ {% if object.organisation %}
+ {{ object.organisation.name }}
+
+ {{ object.organisation.union_account|yesno:'Internal,External' }}
+ {% else %}
+ {{ object.person.name }}
+
+ External
+ {% endif %}
+
+ |
+ {{ object.sum_total|floatformat:2 }} |
+
+ {% if object.mic %}
+ {{ object.mic.initials }}
+
+ {% else %}
+
+ {% endif %}
+ |
+
+
+
+
+ |
+
+ {% endfor %}
+
+
+
{% if is_paginated %}
{% paginator %}
diff --git a/RIGS/templates/RIGS/invoice_list.html b/RIGS/templates/RIGS/invoice_list.html
index 7b080897..2c77d352 100644
--- a/RIGS/templates/RIGS/invoice_list.html
+++ b/RIGS/templates/RIGS/invoice_list.html
@@ -12,47 +12,49 @@
{% paginator %}
{% endif %}
-
-
-
- | # |
- Event |
- Client |
- Event Date |
- Invoice Date |
- Balance |
- |
-
-
-
- {% for object in object_list %}
-
- | {{ object.pk }} |
- N{{ object.event.pk|stringformat:"05d" }}: {{ object.event.name }}
- {{ object.event.get_status_display }} |
-
- {% if object.event.organisation %}
- {{ object.event.organisation.name }}
-
- {{ object.event.organisation.union_account|yesno:'Internal,External' }}
- {% else %}
- {{ object.event.person.name }}
-
- External
- {% endif %}
- |
- {{ object.event.start_date }} |
- {{ object.invoice_date }} |
- {{ object.balance|floatformat:2 }} |
-
-
-
-
- |
+
+
+
+
+ | # |
+ Event |
+ Client |
+ Event Date |
+ Invoice Date |
+ Balance |
+ |
- {% endfor %}
-
-
+
+
+ {% for object in object_list %}
+
+ | {{ object.pk }} |
+ N{{ object.event.pk|stringformat:"05d" }}: {{ object.event.name }}
+ {{ object.event.get_status_display }} |
+
+ {% if object.event.organisation %}
+ {{ object.event.organisation.name }}
+
+ {{ object.event.organisation.union_account|yesno:'Internal,External' }}
+ {% else %}
+ {{ object.event.person.name }}
+
+ External
+ {% endif %}
+ |
+ {{ object.event.start_date }} |
+ {{ object.invoice_date }} |
+ {{ object.balance|floatformat:2 }} |
+
+
+
+
+ |
+
+ {% endfor %}
+
+
+
{% if is_paginated %}
{% paginator %}
From a7247c273edaf26e73a520cc753807f671f8177f Mon Sep 17 00:00:00 2001
From: David Taylor
Date: Tue, 14 Jun 2016 19:50:35 +0100
Subject: [PATCH 043/120] Fixed #245
---
RIGS/templates/RIGS/event_table.html | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/RIGS/templates/RIGS/event_table.html b/RIGS/templates/RIGS/event_table.html
index 1868f2dd..949c710a 100644
--- a/RIGS/templates/RIGS/event_table.html
+++ b/RIGS/templates/RIGS/event_table.html
@@ -1,7 +1,7 @@
- | # |
+ # |
Event Date |
Event Details |
Event Timings |
@@ -23,7 +23,7 @@
danger
{% endif %}
">
- {{ event.pk }} |
+ {{ event.pk }} |
{{ event.start_date|date:"D d/m/Y" }}
{% if event.end_date and event.end_date != event.start_date %}
From e1578eb0d47b8d5a17a57b23b828e32b61a265cc Mon Sep 17 00:00:00 2001
From: David Taylor
Date: Wed, 15 Jun 2016 13:00:14 +0100
Subject: [PATCH 044/120] Fixed responsive table fail
---
RIGS/templates/RIGS/event_invoice.html | 2 +-
RIGS/templates/RIGS/invoice_list.html | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/RIGS/templates/RIGS/event_invoice.html b/RIGS/templates/RIGS/event_invoice.html
index 05b351aa..cd080a74 100644
--- a/RIGS/templates/RIGS/event_invoice.html
+++ b/RIGS/templates/RIGS/event_invoice.html
@@ -22,7 +22,7 @@
{% paginator %}
{% endif %}
-
+
diff --git a/RIGS/templates/RIGS/invoice_list.html b/RIGS/templates/RIGS/invoice_list.html
index 2c77d352..5bd7ef70 100644
--- a/RIGS/templates/RIGS/invoice_list.html
+++ b/RIGS/templates/RIGS/invoice_list.html
@@ -12,7 +12,7 @@
{% paginator %}
{% endif %}
-
+
From 67624eea6f2bae4f44f5c7ae179182d67aed1949 Mon Sep 17 00:00:00 2001
From: David Taylor
Date: Wed, 15 Jun 2016 23:18:46 +0100
Subject: [PATCH 045/120] Allow deleting invoices, if there are no payments yet
---
RIGS/finance.py | 19 ++++++++++
.../RIGS/invoice_confirm_delete.html | 35 +++++++++++++++++++
RIGS/templates/RIGS/invoice_detail.html | 4 +++
RIGS/urls.py | 3 ++
4 files changed, 61 insertions(+)
create mode 100644 RIGS/templates/RIGS/invoice_confirm_delete.html
diff --git a/RIGS/finance.py b/RIGS/finance.py
index 75de8bd9..65fc3b07 100644
--- a/RIGS/finance.py
+++ b/RIGS/finance.py
@@ -94,6 +94,25 @@ class InvoiceVoid(generic.View):
return HttpResponseRedirect(reverse_lazy('invoice_list'))
return HttpResponseRedirect(reverse_lazy('invoice_detail', kwargs={'pk': object.pk}))
+class InvoiceDelete(generic.DeleteView):
+ model = models.Invoice
+
+ def get(self, request, pk):
+ obj = self.get_object()
+ if obj.payment_set.all().count() > 0:
+ messages.info(self.request, 'To delete an invoice, delete the payments first.')
+ return HttpResponseRedirect(reverse_lazy('invoice_detail', kwargs={'pk': obj.pk}))
+ return super(InvoiceDelete, self).get(pk)
+
+ def post(self, request, pk):
+ obj = self.get_object()
+ if obj.payment_set.all().count() > 0:
+ messages.info(self.request, 'To delete an invoice, delete the payments first.')
+ return HttpResponseRedirect(reverse_lazy('invoice_detail', kwargs={'pk': obj.pk}))
+ return super(InvoiceDelete, self).post(pk)
+
+ def get_success_url(self):
+ return self.request.POST.get('next')
class InvoiceArchive(generic.ListView):
model = models.Invoice
diff --git a/RIGS/templates/RIGS/invoice_confirm_delete.html b/RIGS/templates/RIGS/invoice_confirm_delete.html
new file mode 100644
index 00000000..fe295ed6
--- /dev/null
+++ b/RIGS/templates/RIGS/invoice_confirm_delete.html
@@ -0,0 +1,35 @@
+{% extends 'base.html' %}
+
+{% block title %}Delete payment on invoice {{ object.invoice.pk }}{% endblock %}
+
+{% block content %}
+
+
+ Delete invoice {{ object.pk }}
+
+ Are you sure you wish to delete invoice {{ object.pk }}?
+
+ This action cannot be undone!
+
+
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/RIGS/templates/RIGS/invoice_detail.html b/RIGS/templates/RIGS/invoice_detail.html
index ad177ba4..27b4c514 100644
--- a/RIGS/templates/RIGS/invoice_detail.html
+++ b/RIGS/templates/RIGS/invoice_detail.html
@@ -11,6 +11,10 @@
+
+ Delete
+
Void
diff --git a/RIGS/urls.py b/RIGS/urls.py
index 4338df08..ee949ff8 100644
--- a/RIGS/urls.py
+++ b/RIGS/urls.py
@@ -127,6 +127,9 @@ urlpatterns = patterns('',
url(r'^invoice/(?P\d+)/void/$',
permission_required_with_403('RIGS.change_invoice')(finance.InvoiceVoid.as_view()),
name='invoice_void'),
+ url(r'^invoice/(?P\d+)/delete/$',
+ permission_required_with_403('RIGS.change_invoice')(finance.InvoiceDelete.as_view()),
+ name='invoice_delete'),
url(r'^payment/create/$',
permission_required_with_403('RIGS.add_payment')(finance.PaymentCreate.as_view()),
name='payment_create'),
From 667b0c80ca7bc7e8fd2eae8839f969d61c46dcd1 Mon Sep 17 00:00:00 2001
From: David Taylor
Date: Thu, 16 Jun 2016 01:44:59 +0100
Subject: [PATCH 046/120] Added tests for invoice deleting
---
RIGS/test_unit.py | 54 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)
diff --git a/RIGS/test_unit.py b/RIGS/test_unit.py
index 75fcca5a..c51874f4 100644
--- a/RIGS/test_unit.py
+++ b/RIGS/test_unit.py
@@ -155,3 +155,57 @@ class TestAdminMergeObjects(TestCase):
if event.organisation == self.organisations[3]: # The one we left in place
continue
self.assertEqual(updatedEvent.organisation, self.organisations[1])
+
+class TestInvoiceDelete(TestCase):
+ @classmethod
+ def setUpTestData(cls):
+ cls.profile = models.Profile.objects.create(username="testuser1", email="1@test.com", is_superuser=True, is_active=True, is_staff=True)
+
+ cls.events = {
+ 1: models.Event.objects.create(name="TE E1", start_date=date.today()),
+ 2: models.Event.objects.create(name="TE E2", start_date=date.today())
+ }
+
+ cls.invoices = {
+ 1: models.Invoice.objects.create(event=cls.events[1]),
+ 2: models.Invoice.objects.create(event=cls.events[2])
+ }
+
+ cls.payments = {
+ 1: models.Payment.objects.create(invoice=cls.invoices[1], date=date.today(), amount=12.34, method=models.Payment.CASH)
+ }
+
+ def setUp(self):
+ self.profile.set_password('testuser')
+ self.profile.save()
+ self.assertTrue(self.client.login(username=self.profile.username, password='testuser'))
+
+ def test_invoice_delete_allowed(self):
+ request_url = reverse('invoice_delete', kwargs={'pk':self.invoices[2].pk})
+
+ response = self.client.get(request_url, follow=True)
+ self.assertContains(response, "Are you sure")
+
+ # Check the invoice still exists
+ self.assertTrue(models.Invoice.objects.get(pk=self.invoices[2].pk))
+
+ # Actually delete it
+ response = self.client.post(request_url, follow=True)
+
+ # Check the invoice is deleted
+ self.assertRaises(ObjectDoesNotExist, models.Invoice.objects.get, pk=self.invoices[2].pk)
+
+ def test_invoice_delete_not_allowed(self):
+ request_url = reverse('invoice_delete', kwargs={'pk':self.invoices[1].pk})
+
+ response = self.client.get(request_url, follow=True)
+ self.assertContains(response, "To delete an invoice, delete the payments first.")
+
+ # Check the invoice still exists
+ self.assertTrue(models.Invoice.objects.get(pk=self.invoices[1].pk))
+
+ # Try to actually delete it
+ response = self.client.post(request_url, follow=True)
+
+ # Check this didn't work
+ self.assertTrue(models.Invoice.objects.get(pk=self.invoices[1].pk))
\ No newline at end of file
From 05b2de561e3c0a18c05e7f2fcbf0d9fa19bde33a Mon Sep 17 00:00:00 2001
From: David Taylor
Date: Sun, 10 Jul 2016 09:54:35 +0100
Subject: [PATCH 047/120] Added phone links - closes #247
---
RIGS/templates/RIGS/organisation_list.html | 2 +-
RIGS/templates/RIGS/person_list.html | 2 +-
RIGS/templates/RIGS/profile_detail.html | 2 +-
RIGS/templates/RIGS/venue_list.html | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/RIGS/templates/RIGS/organisation_list.html b/RIGS/templates/RIGS/organisation_list.html
index 2c88408a..c8856886 100644
--- a/RIGS/templates/RIGS/organisation_list.html
+++ b/RIGS/templates/RIGS/organisation_list.html
@@ -45,7 +45,7 @@
{{ object.pk }} |
{{ object.name }} |
{{ object.email }} |
- {{ object.phone }} |
+ {{ object.phone }} |
{{ object.notes|yesno|capfirst }} |
{{ object.union_account|yesno|capfirst }} |
diff --git a/RIGS/templates/RIGS/person_list.html b/RIGS/templates/RIGS/person_list.html
index a7c1c08d..2cbdff8e 100644
--- a/RIGS/templates/RIGS/person_list.html
+++ b/RIGS/templates/RIGS/person_list.html
@@ -44,7 +44,7 @@
| {{ person.pk }} |
{{ person.name }} |
{{ person.email }} |
- {{ person.phone }} |
+ {{ person.phone }} |
{{ person.notes|yesno|capfirst }} |
diff --git a/RIGS/templates/RIGS/profile_detail.html b/RIGS/templates/RIGS/profile_detail.html
index e69e7bf0..11904b18 100644
--- a/RIGS/templates/RIGS/profile_detail.html
+++ b/RIGS/templates/RIGS/profile_detail.html
@@ -71,7 +71,7 @@
{{object.initials}}
Phone
- {{object.phone}}
+ {{object.phone}}
{% if not request.is_ajax %}
{% if object.pk == user.pk %}
diff --git a/RIGS/templates/RIGS/venue_list.html b/RIGS/templates/RIGS/venue_list.html
index cf89686c..88ae61ac 100644
--- a/RIGS/templates/RIGS/venue_list.html
+++ b/RIGS/templates/RIGS/venue_list.html
@@ -45,7 +45,7 @@
| {{ object.pk }} |
{{ object.name }} |
{{ object.email }} |
- {{ object.phone }} |
+ {{ object.phone }} |
{{ object.notes|yesno|capfirst }} |
From 39d27d273050cec057b60ebef4d049713f971f06 Mon Sep 17 00:00:00 2001
From: David Taylor
Date: Sun, 10 Jul 2016 10:49:23 +0100
Subject: [PATCH 048/120] 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 %}
- 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 @@
-
+
Event Details
From 01d2eae7bcffd4c36684be2a15afec8da78fabd3 Mon Sep 17 00:00:00 2001
From: David Taylor
Date: Sun, 10 Jul 2016 11:14:24 +0100
Subject: [PATCH 049/120] More invoice UI improvements - makes colouring
consistent - also closes #242
---
RIGS/templates/RIGS/invoice_detail.html | 7 +++++--
RIGS/templates/RIGS/invoice_list.html | 19 +++++++++++++++++--
templates/base.html | 4 ++--
3 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/RIGS/templates/RIGS/invoice_detail.html b/RIGS/templates/RIGS/invoice_detail.html
index 2973c358..af26ad21 100644
--- a/RIGS/templates/RIGS/invoice_detail.html
+++ b/RIGS/templates/RIGS/invoice_detail.html
@@ -38,8 +38,11 @@
-
- Event Details
+
+ Event Details
+ {% if object.void %}(VOID){% elif object.is_closed %}(PAID){% else %}(OUTSTANDING){% endif %}
+
+
- Event Number
diff --git a/RIGS/templates/RIGS/invoice_list.html b/RIGS/templates/RIGS/invoice_list.html
index 5bd7ef70..7dc6d8ee 100644
--- a/RIGS/templates/RIGS/invoice_list.html
+++ b/RIGS/templates/RIGS/invoice_list.html
@@ -29,8 +29,23 @@
{% for object in object_list %}
| {{ object.pk }} |
- N{{ object.event.pk|stringformat:"05d" }}: {{ object.event.name }}
- {{ object.event.get_status_display }} |
+ N{{ object.event.pk|stringformat:"05d" }}: {{ object.event.name }}
+ {{ object.event.get_status_display }}
+ {% if not object.event.mic %}(No MIC){% endif %}
+ |
{% if object.event.organisation %}
{{ object.event.organisation.name }}
diff --git a/templates/base.html b/templates/base.html
index 7a2d15f9..24cc30bc 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -76,9 +76,9 @@
| | | |