From af6b30eaca19d9a317c9b44cf207faa54dc0c0ce Mon Sep 17 00:00:00 2001 From: eeintech Date: Thu, 15 Oct 2020 13:09:00 -0500 Subject: [PATCH 1/6] Added IPN to Supplier Part string representation Improved Supplier Part templates and fixed 'Order Part' button in supplier_part_orders --- InvenTree/company/models.py | 11 +++++++---- .../templates/company/supplier_part_base.html | 2 +- .../templates/company/supplier_part_orders.html | 14 +++++++------- .../templates/company/supplier_part_pricing.html | 4 ++-- .../templates/company/supplier_part_stock.html | 4 ++-- .../templates/order/purchase_order_detail.html | 2 +- 6 files changed, 20 insertions(+), 17 deletions(-) diff --git a/InvenTree/company/models.py b/InvenTree/company/models.py index 2a8d907b76..e9bb3f69d2 100644 --- a/InvenTree/company/models.py +++ b/InvenTree/company/models.py @@ -423,12 +423,15 @@ class SupplierPart(models.Model): return str(self) def __str__(self): - s = "{supplier} ({sku})".format( - sku=self.SKU, - supplier=self.supplier.name) + s = '' + + if self.part.IPN: + s += f'{self.part.IPN}' + + s += f' | {self.supplier.name} | {self.SKU}' if self.manufacturer_string: - s = s + ' - ' + self.manufacturer_string + s = s + ' | ' + self.manufacturer_string return s diff --git a/InvenTree/company/templates/company/supplier_part_base.html b/InvenTree/company/templates/company/supplier_part_base.html index 383b942346..ca09caee93 100644 --- a/InvenTree/company/templates/company/supplier_part_base.html +++ b/InvenTree/company/templates/company/supplier_part_base.html @@ -94,7 +94,7 @@ src="{% static 'img/blank_image.png' %}" {% block js_ready %} {{ block.super }} -$('#order-part').click(function() { +$('#order-part, #order-part2').click(function() { launchModalForm( "{% url 'order-parts' %}", { diff --git a/InvenTree/company/templates/company/supplier_part_orders.html b/InvenTree/company/templates/company/supplier_part_orders.html index 381a2941e9..5c2ea6d1d4 100644 --- a/InvenTree/company/templates/company/supplier_part_orders.html +++ b/InvenTree/company/templates/company/supplier_part_orders.html @@ -6,18 +6,18 @@ {% include "company/supplier_part_tabs.html" with tab='orders' %} -
-

{% trans "Supplier Part Orders" %}

+
+
-
- -
+
+
+
- -
+ +
{% endblock %} diff --git a/InvenTree/company/templates/company/supplier_part_pricing.html b/InvenTree/company/templates/company/supplier_part_pricing.html index 28cc917e1a..f9f5063190 100644 --- a/InvenTree/company/templates/company/supplier_part_pricing.html +++ b/InvenTree/company/templates/company/supplier_part_pricing.html @@ -7,10 +7,10 @@ {% include "company/supplier_part_tabs.html" with tab='pricing' %} -
-

{% trans "Pricing Information" %}

+
+
diff --git a/InvenTree/company/templates/company/supplier_part_stock.html b/InvenTree/company/templates/company/supplier_part_stock.html index 95c2559977..a9b378e27b 100644 --- a/InvenTree/company/templates/company/supplier_part_stock.html +++ b/InvenTree/company/templates/company/supplier_part_stock.html @@ -6,10 +6,10 @@ {% include "company/supplier_part_tabs.html" with tab='stock' %} -
-

{% trans "Supplier Part Stock" %}

+
+ {% include "stock_table.html" %} {% endblock %} diff --git a/InvenTree/order/templates/order/purchase_order_detail.html b/InvenTree/order/templates/order/purchase_order_detail.html index 642ff96d4a..0c569bdca8 100644 --- a/InvenTree/order/templates/order/purchase_order_detail.html +++ b/InvenTree/order/templates/order/purchase_order_detail.html @@ -13,7 +13,7 @@
{% if order.status == PurchaseOrderStatus.PENDING and roles.purchase_order.change %} - + {% endif %}
From dfa4d3f8ed6800127eef3fd667add65c21793fe9 Mon Sep 17 00:00:00 2001 From: eeintech Date: Sun, 18 Oct 2020 14:37:35 -0500 Subject: [PATCH 2/6] Display IPN and pipe char only if IPN exists --- InvenTree/company/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/InvenTree/company/models.py b/InvenTree/company/models.py index e9bb3f69d2..f1e249fd58 100644 --- a/InvenTree/company/models.py +++ b/InvenTree/company/models.py @@ -427,8 +427,9 @@ class SupplierPart(models.Model): if self.part.IPN: s += f'{self.part.IPN}' + s += ' | ' - s += f' | {self.supplier.name} | {self.SKU}' + s += f'{self.supplier.name} | {self.SKU}' if self.manufacturer_string: s = s + ' | ' + self.manufacturer_string From 634410294b5f43281437c12bffb96894e18b0fee Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Mon, 19 Oct 2020 11:40:57 +1100 Subject: [PATCH 3/6] Display table of items received against a particular purchase order - Adds new tab to "Purchase Order" view - Adds ability to filter StockList API by purchase_order ID --- .../templates/order/po_received_items.html | 34 +++++++++++++++++++ InvenTree/order/templates/order/po_tabs.html | 5 ++- InvenTree/order/urls.py | 1 + InvenTree/stock/api.py | 5 +++ InvenTree/templates/js/stock.html | 2 +- 5 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 InvenTree/order/templates/order/po_received_items.html diff --git a/InvenTree/order/templates/order/po_received_items.html b/InvenTree/order/templates/order/po_received_items.html new file mode 100644 index 0000000000..b3b46c4aa4 --- /dev/null +++ b/InvenTree/order/templates/order/po_received_items.html @@ -0,0 +1,34 @@ +{% extends "order/order_base.html" %} + +{% load inventree_extras %} +{% load i18n %} +{% load static %} + +{% block details %} + +{% include 'order/po_tabs.html' with tab='received' %} + +

{% trans "Received Items" %}

+
+ +{% include "stock_table.html" with read_only=True %} + +{% endblock %} + +{% block js_ready %} +{{ block.super }} + +loadStockTable($("#stock-table"), { + params: { + purchase_order: {{ order.id }}, + part_detail: true, + supplier_detail: true, + location_detail: true, + }, + buttons: [ + '#stock-options', + ], + filterkey: "postock" +}); + +{% endblock %} \ No newline at end of file diff --git a/InvenTree/order/templates/order/po_tabs.html b/InvenTree/order/templates/order/po_tabs.html index d5c7286c3f..5792107b04 100644 --- a/InvenTree/order/templates/order/po_tabs.html +++ b/InvenTree/order/templates/order/po_tabs.html @@ -2,7 +2,10 @@