fix templates

This commit is contained in:
Matthias 2022-05-02 22:41:24 +02:00
parent 8f3899ffe6
commit e7b189ba29
No known key found for this signature in database
GPG Key ID: AB6D0E6C4CB65093
8 changed files with 35 additions and 7 deletions

View File

@ -90,7 +90,11 @@ src="{% static 'img/blank_image.png' %}"
<tr> <tr>
<td><span class='fas fa-industry'></span></td> <td><span class='fas fa-industry'></span></td>
<td>{% trans "Manufacturer" %}</td> <td>{% trans "Manufacturer" %}</td>
<td><a href="{% url 'company-detail' part.manufacturer.id %}">{{ part.manufacturer.name }}</a>{% include "clip.html"%}</td> <td>
{% if part.manufacturer %}
<a href="{% url 'company-detail' part.manufacturer.id %}">{{ part.manufacturer.name }}</a>{% include "clip.html"%}
{% endif %}
</td>
</tr> </tr>
<tr> <tr>
<td><span class='fas fa-hashtag'></span></td> <td><span class='fas fa-hashtag'></span></td>
@ -324,7 +328,9 @@ $('#delete-part').click(function() {
deleteManufacturerPart({{ part.pk }}, { deleteManufacturerPart({{ part.pk }}, {
onSuccess: function() { onSuccess: function() {
{% if part.manufacturer %}
window.location.href = "{% url 'company-detail' part.manufacturer.id %}"; window.location.href = "{% url 'company-detail' part.manufacturer.id %}";
{% endif %}
} }
}); });
}); });

View File

@ -85,7 +85,11 @@ src="{% static 'img/blank_image.png' %}"
<tr> <tr>
<td><span class='fas fa-building'></span></td> <td><span class='fas fa-building'></span></td>
<td>{% trans "Supplier" %}</td> <td>{% trans "Supplier" %}</td>
<td><a href="{% url 'company-detail' part.supplier.id %}">{{ part.supplier.name }}</a>{% include "clip.html"%}</td></tr> <td>{% if part.supplier %}
<a href="{% url 'company-detail' part.supplier.id %}">{{ part.supplier.name }}</a>{% include "clip.html"%}
{% endif %}
</td>
</tr>
<tr> <tr>
<td><span class='fas fa-hashtag'></span></td> <td><span class='fas fa-hashtag'></span></td>
<td>{% trans "SKU" %}</td> <td>{% trans "SKU" %}</td>
@ -350,7 +354,9 @@ $('#delete-part').click(function() {
deleteSupplierPart({{ part.pk }}, { deleteSupplierPart({{ part.pk }}, {
onSuccess: function() { onSuccess: function() {
{% if part.supplier %}
window.location.href = "{% url 'company-detail' part.supplier.id %}"; window.location.href = "{% url 'company-detail' part.supplier.id %}";
{% endif %}
} }
}); });
}); });

View File

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

View File

@ -32,6 +32,7 @@
<th colspan='2'>{% trans "Select Purchase Order" %}</th> <th colspan='2'>{% trans "Select Purchase Order" %}</th>
</tr> </tr>
{% for supplier in suppliers %} {% for supplier in suppliers %}
{% if supplier %}
<tr id='suppier_row_{{ supplier.id }}'> <tr id='suppier_row_{{ supplier.id }}'>
<td> <td>
{% include 'hover_image.html' with image=supplier.image hover=False %} {% include 'hover_image.html' with image=supplier.image hover=False %}
@ -70,6 +71,7 @@
</div> </div>
</td> </td>
</tr> </tr>
{% endif %}
{% endfor %} {% endfor %}
</table> </table>

View File

@ -170,10 +170,12 @@ $('#new-po-line').click(function() {
var fields = poLineItemFields({ var fields = poLineItemFields({
order: {{ order.pk }}, order: {{ order.pk }},
{% if order.supplier %}
supplier: {{ order.supplier.pk }}, supplier: {{ order.supplier.pk }},
{% if order.supplier.currency %} {% if order.supplier.currency %}
currency: '{{ order.supplier.currency }}', currency: '{{ order.supplier.currency }}',
{% endif %} {% endif %}
{% endif %}
}); });
constructForm('{% url "api-po-line-list" %}', { constructForm('{% url "api-po-line-list" %}', {
@ -210,7 +212,9 @@ $('#new-po-line').click(function() {
loadPurchaseOrderLineItemTable('#po-line-table', { loadPurchaseOrderLineItemTable('#po-line-table', {
order: {{ order.pk }}, order: {{ order.pk }},
{% if order.supplier %}
supplier: {{ order.supplier.pk }}, supplier: {{ order.supplier.pk }},
{% endif %}
{% if roles.purchase_order.change %} {% if roles.purchase_order.change %}
allow_edit: true, allow_edit: true,
{% else %} {% else %}

View File

@ -43,7 +43,7 @@
<p>{% blocktrans with count=part.manufacturer_parts.all|length %}There are {{count}} manufacturers defined for this part. If you delete this part, the following manufacturer parts will also be deleted:{% endblocktrans %} <p>{% blocktrans with count=part.manufacturer_parts.all|length %}There are {{count}} manufacturers defined for this part. If you delete this part, the following manufacturer parts will also be deleted:{% endblocktrans %}
<ul class='list-group'> <ul class='list-group'>
{% for spart in part.manufacturer_parts.all %} {% for spart in part.manufacturer_parts.all %}
<li class='list-group-item'>{{ spart.manufacturer.name }} - {{ spart.MPN }}</li> <li class='list-group-item'>{% if spart.manufacturer %}{{ spart.manufacturer.name }} - {% endif %}{{ spart.MPN }}</li>
{% endfor %} {% endfor %}
</ul> </ul>
</p> </p>
@ -54,7 +54,9 @@
<p>{% blocktrans with count=part.supplier_parts.all|length %}There are {{count}} suppliers defined for this part. If you delete this part, the following supplier parts will also be deleted:{% endblocktrans %} <p>{% blocktrans with count=part.supplier_parts.all|length %}There are {{count}} suppliers defined for this part. If you delete this part, the following supplier parts will also be deleted:{% endblocktrans %}
<ul class='list-group'> <ul class='list-group'>
{% for spart in part.supplier_parts.all %} {% for spart in part.supplier_parts.all %}
{% if spart.supplier %}
<li class='list-group-item'>{{ spart.supplier.name }} - {{ spart.SKU }}</li> <li class='list-group-item'>{{ spart.supplier.name }} - {{ spart.SKU }}</li>
{% endif %}
{% endfor %} {% endfor %}
</ul> </ul>
</p> </p>

View File

@ -74,7 +74,7 @@ table td.expand {
<div class='header-right'> <div class='header-right'>
<h3>{% trans "Purchase Order" %} {{ prefix }}{{ reference }}</h3> <h3>{% trans "Purchase Order" %} {{ prefix }}{{ reference }}</h3>
{{ supplier.name }} {% if supplier %}{{ supplier.name }}{% endif %}
</div> </div>
{% endblock %} {% endblock %}

View File

@ -379,7 +379,11 @@
<tr> <tr>
<td><span class='fas fa-building'></span></td> <td><span class='fas fa-building'></span></td>
<td>{% trans "Supplier" %}</td> <td>{% trans "Supplier" %}</td>
<td><a href="{% url 'company-detail' item.supplier_part.supplier.id %}">{{ item.supplier_part.supplier.name }}</a></td> <td>
{% if item.supplier_part.supplier %}
<a href="{% url 'company-detail' item.supplier_part.supplier.id %}">{{ item.supplier_part.supplier.name }}</a>
{% endif %}
</td>
</tr> </tr>
<tr> <tr>
<td><span class='fas fa-shapes'></span></td> <td><span class='fas fa-shapes'></span></td>