From e7b189ba29f2751d6f5cef39c92a0e0aeaca3f31 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 2 May 2022 22:41:24 +0200 Subject: [PATCH] fix templates --- .../company/templates/company/manufacturer_part.html | 8 +++++++- InvenTree/company/templates/company/supplier_part.html | 8 +++++++- InvenTree/order/templates/order/order_base.html | 8 ++++++-- .../order/templates/order/order_wizard/select_pos.html | 2 ++ .../order/templates/order/purchase_order_detail.html | 4 ++++ InvenTree/part/templates/part/partial_delete.html | 4 +++- .../report/templates/report/inventree_po_report.html | 2 +- InvenTree/stock/templates/stock/item_base.html | 6 +++++- 8 files changed, 35 insertions(+), 7 deletions(-) diff --git a/InvenTree/company/templates/company/manufacturer_part.html b/InvenTree/company/templates/company/manufacturer_part.html index fb33128a77..884faffc8f 100644 --- a/InvenTree/company/templates/company/manufacturer_part.html +++ b/InvenTree/company/templates/company/manufacturer_part.html @@ -90,7 +90,11 @@ src="{% static 'img/blank_image.png' %}" {% trans "Manufacturer" %} - {{ part.manufacturer.name }}{% include "clip.html"%} + + {% if part.manufacturer %} + {{ part.manufacturer.name }}{% include "clip.html"%} + {% endif %} + @@ -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 %} } }); }); diff --git a/InvenTree/company/templates/company/supplier_part.html b/InvenTree/company/templates/company/supplier_part.html index 67902dc6f6..e7d9633bba 100644 --- a/InvenTree/company/templates/company/supplier_part.html +++ b/InvenTree/company/templates/company/supplier_part.html @@ -85,7 +85,11 @@ src="{% static 'img/blank_image.png' %}" {% trans "Supplier" %} - {{ part.supplier.name }}{% include "clip.html"%} + {% if part.supplier %} + {{ part.supplier.name }}{% include "clip.html"%} + {% endif %} + + {% trans "SKU" %} @@ -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 %} } }); }); diff --git a/InvenTree/order/templates/order/order_base.html b/InvenTree/order/templates/order/order_base.html index c2aa10f722..7596e8da3a 100644 --- a/InvenTree/order/templates/order/order_base.html +++ b/InvenTree/order/templates/order/order_base.html @@ -67,7 +67,7 @@ {% block thumbnail %} {% trans "Supplier" %} - {{ order.supplier.name }}{% include "clip.html"%} + + {% if order.supplier %} + {{ order.supplier.name }}{% include "clip.html"%} + {% endif %} + {% if order.supplier_reference %} diff --git a/InvenTree/order/templates/order/order_wizard/select_pos.html b/InvenTree/order/templates/order/order_wizard/select_pos.html index 6ef2f6c910..2aae7a42ac 100644 --- a/InvenTree/order/templates/order/order_wizard/select_pos.html +++ b/InvenTree/order/templates/order/order_wizard/select_pos.html @@ -32,6 +32,7 @@ {% trans "Select Purchase Order" %} {% for supplier in suppliers %} + {% if supplier %} {% include 'hover_image.html' with image=supplier.image hover=False %} @@ -70,6 +71,7 @@ + {% endif %} {% endfor %} diff --git a/InvenTree/order/templates/order/purchase_order_detail.html b/InvenTree/order/templates/order/purchase_order_detail.html index 23bdd908e1..542a7a90ca 100644 --- a/InvenTree/order/templates/order/purchase_order_detail.html +++ b/InvenTree/order/templates/order/purchase_order_detail.html @@ -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 %} diff --git a/InvenTree/part/templates/part/partial_delete.html b/InvenTree/part/templates/part/partial_delete.html index eb23fbee09..22c739b833 100644 --- a/InvenTree/part/templates/part/partial_delete.html +++ b/InvenTree/part/templates/part/partial_delete.html @@ -43,7 +43,7 @@

{% 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 %}

@@ -54,7 +54,9 @@

{% 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 %}

diff --git a/InvenTree/report/templates/report/inventree_po_report.html b/InvenTree/report/templates/report/inventree_po_report.html index d1cae75c3b..427410576c 100644 --- a/InvenTree/report/templates/report/inventree_po_report.html +++ b/InvenTree/report/templates/report/inventree_po_report.html @@ -74,7 +74,7 @@ table td.expand {

{% trans "Purchase Order" %} {{ prefix }}{{ reference }}

- {{ supplier.name }} + {% if supplier %}{{ supplier.name }}{% endif %}
{% endblock %} diff --git a/InvenTree/stock/templates/stock/item_base.html b/InvenTree/stock/templates/stock/item_base.html index dd77d26d1c..4c8af402cf 100644 --- a/InvenTree/stock/templates/stock/item_base.html +++ b/InvenTree/stock/templates/stock/item_base.html @@ -379,7 +379,11 @@ {% trans "Supplier" %} - {{ item.supplier_part.supplier.name }} + + {% if item.supplier_part.supplier %} + {{ item.supplier_part.supplier.name }} + {% endif %} +