aboutsummaryrefslogtreecommitdiffstats
path: root/servo
diff options
context:
space:
mode:
Diffstat (limited to 'servo')
-rw-r--r--servo/models/parts.py1
-rw-r--r--servo/models/repair.py6
-rw-r--r--servo/views/gsx.py3
-rw-r--r--servo/views/note.py23
-rw-r--r--servo/views/order.py2
5 files changed, 22 insertions, 13 deletions
diff --git a/servo/models/parts.py b/servo/models/parts.py
index c7076d8..f854fdc 100644
--- a/servo/models/parts.py
+++ b/servo/models/parts.py
@@ -264,6 +264,7 @@ class ServicePart(models.Model):
part.returnOrderNumber = self.return_order
if self.box_number > 0:
part.boxNumber = self.box_number
+
return part
def needs_comptia_code(self):
diff --git a/servo/models/repair.py b/servo/models/repair.py
index c7ae4a1..9649b86 100644
--- a/servo/models/repair.py
+++ b/servo/models/repair.py
@@ -190,6 +190,9 @@ class Repair(models.Model):
issue_code = models.CharField(max_length=7, default='')
def get_symptom_code_choices(self):
+ """
+ Returns the possible symptom codes for the current serial number
+ """
# @fixme: what if it's someone else ordering the part?
self.gsx_account.connect(self.created_by)
ckey = 'symptom_codes-%s' % self.device.sn
@@ -197,6 +200,9 @@ class Repair(models.Model):
return cache_getset(ckey, si.fetch)
def get_issue_code_choices(self):
+ """
+ Returns the possible issue codes for the current symptom code
+ """
# @fixme: what if it's someone else ordering the part?
self.gsx_account.connect(self.created_by)
ckey = 'issue_codes-%s' % self.symptom_code
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)