aboutsummaryrefslogtreecommitdiffstats
path: root/servo/views
diff options
context:
space:
mode:
Diffstat (limited to 'servo/views')
-rw-r--r--servo/views/gsx.py3
-rw-r--r--servo/views/note.py23
-rw-r--r--servo/views/order.py2
3 files changed, 15 insertions, 13 deletions
diff --git a/servo/views/gsx.py b/servo/views/gsx.py
index 2195c45..4208c23 100644
--- a/servo/views/gsx.py
+++ b/servo/views/gsx.py
@@ -135,6 +135,7 @@ def remove_part(request, repair, part):
def delete_repair(request, repair_id):
repair = get_object_or_404(Repair, pk=repair_id)
+
if repair.submitted_at:
messages.error(request, _('Submitted repairs cannot be deleted'))
return redirect(repair.order)
@@ -216,7 +217,7 @@ def edit_repair(request, order_id, repair_id):
order = get_object_or_404(Order, pk=order_id)
repair = get_object_or_404(Repair, pk=repair_id)
- if request.GET.get('c'):
+ if request.GET.get('c'): # looking up issue code for symptom
repair.symptom_code = request.GET['c']
repair.save()
choices = repair.get_issue_code_choices()
diff --git a/servo/views/note.py b/servo/views/note.py
index 5cd47c8..803f1a2 100644
--- a/servo/views/note.py
+++ b/servo/views/note.py
@@ -19,19 +19,17 @@ from reportlab.graphics.shapes import Drawing
from reportlab.graphics.barcode import createBarcodeDrawing
from servo.lib.utils import paginate
-from servo.models import Order, Template, Tag, Customer, Note, Attachment, Escalation
+from servo.models import (Order, Template, Tag, Customer, Note,
+ Attachment, Escalation,)
from servo.forms import NoteForm, NoteSearchForm, EscalationForm
class BarcodeDrawing(Drawing):
def __init__(self, text_value, *args, **kwargs):
- barcode = createBarcodeDrawing(
- "Code128",
- value=text_value.encode("utf-8"),
- barHeight=10*mm,
- width=80*mm
- )
-
+ barcode = createBarcodeDrawing("Code128",
+ value=text_value.encode("utf-8"),
+ barHeight=10*mm,
+ width=80*mm)
Drawing.__init__(self, barcode.width, barcode.height, *args, **kwargs)
self.add(barcode, name="barcode")
@@ -96,7 +94,7 @@ def copy(request, pk):
new_note.labels = note.labels.all()
- for a in note.attachments.all():
+ for a in note.attachments.all(): # also copy the attachments
a.pk = None
a.content_object = new_note
a.save()
@@ -106,9 +104,11 @@ def copy(request, pk):
@permission_required('servo.change_note')
-def edit(request, pk=None, order_id=None, parent=None, recipient=None, customer=None):
+def edit(request, pk=None, order_id=None, parent=None, recipient=None,
+ customer=None):
"""
Edits a note
+ @FIXME: Should split this up into smaller pieces
"""
to = []
order = None
@@ -187,7 +187,8 @@ def edit(request, pk=None, order_id=None, parent=None, recipient=None, customer=
if note.escalation:
contexts = json.loads(note.escalation.contexts)
- escalation_form = EscalationForm(prefix='escalation', instance=note.escalation)
+ escalation_form = EscalationForm(prefix='escalation',
+ instance=note.escalation)
if request.method == "POST":
escalation_form = EscalationForm(request.POST,
diff --git a/servo/views/order.py b/servo/views/order.py
index a12fec2..e9d5a51 100644
--- a/servo/views/order.py
+++ b/servo/views/order.py
@@ -211,7 +211,7 @@ def close(request, pk):
return redirect(order)
- data = {'order': order, 'action': request.path}
+ data = {'order': order, 'action': reverse(close, args=[pk])}
return render(request, "orders/close.html", data)