From 23f35cfec06d4c3c73ae7a61017a304e5b8000f8 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Wed, 19 May 2021 20:58:48 +0300 Subject: Work authorization fixes --- servo/models/note.py | 2 +- servo/models/order.py | 5 +++- servo/templates/orders/print_confirmation.html | 40 +++++++++++--------------- servo/views/order.py | 3 +- 4 files changed, 23 insertions(+), 27 deletions(-) diff --git a/servo/models/note.py b/servo/models/note.py index ab6b622..e7ab2dd 100644 --- a/servo/models/note.py +++ b/servo/models/note.py @@ -145,7 +145,7 @@ class Note(MPTTModel): (T_NOTE, _("Technician's Note")), (T_CUSTOMER_NOTE, _("Customer's Note")), (T_PROBLEM, _("Customer Reported Issue")), - (T_VERIFIED_PROBLEM, _("Verified Verified Issue")), + (T_VERIFIED_PROBLEM, _("Technician Verified Issue")), (T_DIAGNOSIS, _("Diagnosis")), (T_ESCALATION, _("Escalation")), ) diff --git a/servo/models/order.py b/servo/models/order.py index 574637d..8bf4dd6 100644 --- a/servo/models/order.py +++ b/servo/models/order.py @@ -287,10 +287,13 @@ class Order(models.Model): r = {'order': self} r['conf'] = Configuration.conf() r['title'] = _(u"Service Order #%s") % self.code + r['notes'] = self.note_set.filter(is_reported=True) + # TODO: replace with constants - r['issues'] = r['notes'].filter(type=2) + r['issues'] = r['notes'].filter(type=1) r['diagnoses'] = r['notes'].filter(type=3) + r['tech_notes'] = r['notes'].filter(type=0) r['verified_issues'] = r['notes'].filter(type=4) r['customer_notes'] = r['notes'].filter(type=5) diff --git a/servo/templates/orders/print_confirmation.html b/servo/templates/orders/print_confirmation.html index b82cc70..1bd0844 100755 --- a/servo/templates/orders/print_confirmation.html +++ b/servo/templates/orders/print_confirmation.html @@ -7,22 +7,20 @@ {% block content %} {% with order.location as location %}
-
+
{% if conf.company_logo %} logo {% endif %} -
-
- {{ location.title }}
+ {{ location.title }}
{{ location.address }}
- {{ location.zip_code }}, {{ location.city }}
- {{ location.notes }} + {{ location.zip_code }}, {{ location.city }} + {{ location.email }}
+ {{ location.phone }}
-
+
+ {{ location.notes }} {% block location_info %} {% endblock location_info %} - {% trans "Email" %}: {{ location.email }}
- {% trans "Phone" %}: {{ location.phone }}

{% endwith %} @@ -86,36 +84,32 @@
- {% block work_description %} + {% block work_description %} {% if order.reported_notes.count > 0 %}

{% trans "Problem Description" %}


- {%trans "Customer Reported Issue" %}: - {% for n in data.issues %} - {{ n.body }} - {% endfor %} + {% trans "Customer Reported Issue" %}: + {% for n in issues %} {{ n.body }} {% endfor %}

- {%trans "Technician Verified Issue" %}: - {% for n in data.verified_issues %} - {{ n.body }} - {% endfor %} + {% trans "Technician Verified Issue" %}: + {% for n in verified_issues %} {{ n.body }} {% endfor %}

- {%trans "Customer Notes" %}: - {% for n in data.customer_notes %} + {% trans "Customer Notes" %}: + {% for n in customer_notes %} {{ n.body }} {% endfor %}

- {%trans "Technician Notes" %}: - {% for n in order.reported_notes %} + {% trans "Technician Notes" %}: + {% for n in tech_notes %} {{ n.body }} {% endfor %}

{% endif %} - {% endblock work_description %} + {% endblock work_description %}
diff --git a/servo/views/order.py b/servo/views/order.py index b6fae0a..18c2e3a 100644 --- a/servo/views/order.py +++ b/servo/views/order.py @@ -564,8 +564,7 @@ def put_on_paper(request, pk, kind="confirmation", fmt='html'): if fmt == 'pdf': fn = data.get('title') + '.pdf' - view = PDFTemplateView(request=request, template_name=template, - filename=fn) + view = PDFTemplateView(request=request, template_name=template, filename=fn) return view.render_to_response(data) return render(request, template, data) -- cgit v1.2.3