Check if customer exists when rendering sales order template

Fixes https://github.com/inventree/InvenTree/issues/1742
This commit is contained in:
Oliver 2021-11-05 11:03:38 +11:00
parent cb990af3a9
commit 1743111613

View File

@ -16,7 +16,7 @@
{% block thumbnail %} {% block thumbnail %}
<img class='part-thumb' <img class='part-thumb'
{% if order.customer.image %} {% if order.customer and order.customer.image %}
src="{{ order.customer.image.url }}" src="{{ order.customer.image.url }}"
{% else %} {% else %}
src="{% static 'img/blank_image.png' %}" src="{% static 'img/blank_image.png' %}"
@ -106,11 +106,13 @@ src="{% static 'img/blank_image.png' %}"
{% endif %} {% endif %}
</td> </td>
</tr> </tr>
{% if order.customer %}
<tr> <tr>
<td><span class='fas fa-building'></span></td> <td><span class='fas fa-building'></span></td>
<td>{% trans "Customer" %}</td> <td>{% trans "Customer" %}</td>
<td><a href="{% url 'company-detail' order.customer.id %}">{{ order.customer.name }}</a>{% include "clip.html"%}</td> <td><a href="{% url 'company-detail' order.customer.id %}">{{ order.customer.name }}</a>{% include "clip.html"%}</td>
</tr> </tr>
{% endif %}
{% if order.customer_reference %} {% if order.customer_reference %}
<tr> <tr>
<td><span class='fas fa-hashtag'></span></td> <td><span class='fas fa-hashtag'></span></td>