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>
<td><span class='fas fa-industry'></span></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>
<td><span class='fas fa-hashtag'></span></td>
@ -324,7 +328,9 @@ $('#delete-part').click(function() {
deleteManufacturerPart({{ part.pk }}, {
onSuccess: function() {
{% if part.manufacturer %}
window.location.href = "{% url 'company-detail' part.manufacturer.id %}";
{% endif %}
}
});
});

View File

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

View File

@ -67,7 +67,7 @@
{% block thumbnail %}
<img class='part-thumb'
{% if order.supplier.image %}
{% if order.supplier and order.supplier.image %}
src="{{ order.supplier.image.url }}"
{% else %}
src="{% static 'img/blank_image.png' %}"
@ -110,7 +110,11 @@ src="{% static 'img/blank_image.png' %}"
<tr>
<td><span class='fas fa-building'></span></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>
{% if order.supplier_reference %}
<tr>

View File

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

View File

@ -170,10 +170,12 @@ $('#new-po-line').click(function() {
var fields = poLineItemFields({
order: {{ order.pk }},
{% if order.supplier %}
supplier: {{ order.supplier.pk }},
{% if order.supplier.currency %}
currency: '{{ order.supplier.currency }}',
{% endif %}
{% endif %}
});
constructForm('{% url "api-po-line-list" %}', {
@ -210,7 +212,9 @@ $('#new-po-line').click(function() {
loadPurchaseOrderLineItemTable('#po-line-table', {
order: {{ order.pk }},
{% if order.supplier %}
supplier: {{ order.supplier.pk }},
{% endif %}
{% if roles.purchase_order.change %}
allow_edit: true,
{% 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 %}
<ul class='list-group'>
{% 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 %}
</ul>
</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 %}
<ul class='list-group'>
{% for spart in part.supplier_parts.all %}
{% if spart.supplier %}
<li class='list-group-item'>{{ spart.supplier.name }} - {{ spart.SKU }}</li>
{% endif %}
{% endfor %}
</ul>
</p>

View File

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

View File

@ -379,7 +379,11 @@
<tr>
<td><span class='fas fa-building'></span></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>
<td><span class='fas fa-shapes'></span></td>