From 6e9937e0e9996a1c1e0ac9dcd25fd39a3bbfb764 Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 30 Nov 2021 15:24:19 +1100 Subject: [PATCH 01/25] Don't be dull, check for null --- InvenTree/templates/js/translated/order.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/InvenTree/templates/js/translated/order.js b/InvenTree/templates/js/translated/order.js index c61722858d..a471182399 100644 --- a/InvenTree/templates/js/translated/order.js +++ b/InvenTree/templates/js/translated/order.js @@ -701,6 +701,11 @@ function loadPurchaseOrderTable(table, options) { switchable: true, sortable: false, formatter: function(value, row) { + + if (!row.responsible_detail) { + return '-'; + } + var html = row.responsible_detail.name; if (row.responsible_detail.label == 'group') { From b34b3c6d85db19eedfe83c4b8a26abe7be9bc459 Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 30 Nov 2021 19:38:48 +1100 Subject: [PATCH 02/25] Place part details below main part display tab --- InvenTree/part/templates/part/detail.html | 107 --------- InvenTree/part/templates/part/part_base.html | 212 ++++++++++++++---- .../part/templates/part/part_sidebar.html | 2 - InvenTree/templates/page_base.html | 12 +- 4 files changed, 176 insertions(+), 157 deletions(-) diff --git a/InvenTree/part/templates/part/detail.html b/InvenTree/part/templates/part/detail.html index 4cf6f5e824..ce78e445e1 100644 --- a/InvenTree/part/templates/part/detail.html +++ b/InvenTree/part/templates/part/detail.html @@ -11,113 +11,6 @@ {% block page_content %} -
-
-

{% trans "Part Details" %}

-
-
- - - - - - - - - - - - - - - {% if part.category %} - - - - - - {% endif %} - {% if part.IPN %} - - - - - - {% endif %} - {% if part.revision %} - - - - - - {% endif %} - {% if part.units %} - - - - - - {% endif %} - {% if part.minimum_stock %} - - - - - - {% endif %} - {% if part.keywords %} - - - - - - {% endif %} - {% if part.link %} - - - - - - {% endif %} - - - - - - {% if part.trackable and part.getLatestSerialNumber %} - - - - - - {% endif %} - {% if part.default_location %} - - - - - - {% endif %} - {% if part.default_supplier %} - - - - - - {% endif %} -
{% trans "Name" %}{{ part.name }}{% include "clip.html"%}
{% trans "Description" %}{{ part.description }}{% include "clip.html"%}
{% trans "Category" %} - {{ part.category.name }} -
{% trans "IPN" %}{{ part.IPN }}{% include "clip.html"%}
{% trans "Revision" %}{{ part.revision }}{% include "clip.html"%}
{% trans "Units" %}{{ part.units }}
{% trans "Minimum stock level" %}{{ part.minimum_stock }}
{% trans "Keywords" %}{{ part.keywords }}{% include "clip.html"%}
{% trans "External Link" %}{{ part.link }}{% include "clip.html"%}
{% trans "Creation Date" %} - {{ part.creation_date }} - {% if part.creation_user %} - {{ part.creation_user }} - {% endif %} -
{% trans "Latest Serial Number" %}{{ part.getLatestSerialNumber }}{% include "clip.html"%}
{% trans "Default Location" %} - {{ part.default_location }} -
{% trans "Default Supplier" %}{{ part.default_supplier }}
-
-
-
diff --git a/InvenTree/part/templates/part/part_base.html b/InvenTree/part/templates/part/part_base.html index 4ca7c80d65..4e85853e69 100644 --- a/InvenTree/part/templates/part/part_base.html +++ b/InvenTree/part/templates/part/part_base.html @@ -99,54 +99,74 @@ {% block details %} - -

-
- {% if part.is_template %} -   - - {% endif %} - {% if part.assembly %} -   - - {% endif %} - {% if part.component %} -   - - {% endif %} - {% if part.trackable %} -   - - {% endif %} - {% if part.purchaseable %} -   - - {% endif %} - {% if part.salable %} -   - - {% endif %} - - {% if not part.active %} -   -
- - {% trans 'Inactive' %} +
+
+ {% if part.is_template %} +   + + {% endif %} + {% if part.assembly %} +   + + {% endif %} + {% if part.component %} +   + + {% endif %} + {% if part.trackable %} +   + + {% endif %} + {% if part.purchaseable %} +   + + {% endif %} + {% if part.salable %} +   + + {% endif %} + + {% if not part.active %} +   +
+ + {% trans 'Inactive' %} +
+ {% endif %} + + {% if part.virtual and part.active %} +   +
+ + {% trans 'Virtual' %} +
+ {% endif %}
- {% endif %} - - {% if part.virtual and part.active %} -   -
- - {% trans 'Virtual' %} -
- {% endif %} + + {% include "spacer.html" %} +

+ + + + + + + + + + + + +
{% trans "Part Name" %}{{ part.full_name }}{% include "clip.html"%}
{% trans "Description" %}{{ part.description }}{% include "clip.html"%}
+
{% if part.variant_of %} @@ -157,7 +177,7 @@ {% endif %}
-{% endblock %} +{% endblock details %} {% block details_right %} @@ -231,7 +251,111 @@ {% endif %} {% endif %}
-{% endblock %} +{% endblock details_right %} + +{% block details_below %} + +
+
+
+ + + + {% if part.category %} + + + + + + {% endif %} + {% if part.IPN %} + + + + + + {% endif %} + {% if part.revision %} + + + + + + {% endif %} + {% if part.units %} + + + + + + {% endif %} + {% if part.minimum_stock %} + + + + + + {% endif %} + {% if part.keywords %} + + + + + + {% endif %} +
{% trans "Category" %} + {{ part.category.name }} +
{% trans "IPN" %}{{ part.IPN }}{% include "clip.html"%}
{% trans "Revision" %}{{ part.revision }}{% include "clip.html"%}
{% trans "Units" %}{{ part.units }}
{% trans "Minimum stock level" %}{{ part.minimum_stock }}
{% trans "Keywords" %}{{ part.keywords }}{% include "clip.html"%}
+
+
+ + + + + + + + {% if part.trackable and part.getLatestSerialNumber %} + + + + + + {% endif %} + {% if part.default_location %} + + + + + + {% endif %} + {% if part.default_supplier %} + + + + + + {% endif %} + {% if part.link %} + + + + + + {% endif %} +
{% trans "Creation Date" %} + {{ part.creation_date }} + {% if part.creation_user %} + {{ part.creation_user }} + {% endif %} +
{% trans "Latest Serial Number" %}{{ part.getLatestSerialNumber }}{% include "clip.html"%}
{% trans "Default Location" %} + {{ part.default_location }} +
{% trans "Default Supplier" %}{{ part.default_supplier }}
{% trans "External Link" %}{{ part.link }}{% include "clip.html"%}
+
+
+
+ +{% endblock details_below %} {% block js_ready %} {{ block.super }} diff --git a/InvenTree/part/templates/part/part_sidebar.html b/InvenTree/part/templates/part/part_sidebar.html index c590c51c37..f4e59af865 100644 --- a/InvenTree/part/templates/part/part_sidebar.html +++ b/InvenTree/part/templates/part/part_sidebar.html @@ -5,8 +5,6 @@ {% settings_value "PART_INTERNAL_PRICE" as show_internal_price %} {% settings_value 'PART_SHOW_RELATED' as show_related %} -{% trans "Details" as text %} -{% include "sidebar_item.html" with label="part-details" text=text icon="fa-shapes" %} {% trans "Parameters" as text %} {% include "sidebar_item.html" with label="part-parameters" text=text icon="fa-th-list" %} {% if part.is_template %} diff --git a/InvenTree/templates/page_base.html b/InvenTree/templates/page_base.html index 506120972a..4e805142d2 100644 --- a/InvenTree/templates/page_base.html +++ b/InvenTree/templates/page_base.html @@ -24,6 +24,8 @@ {% block page_info %}
+ {% block details_above %} + {% endblock details_above %}
@@ -31,23 +33,25 @@
{% block thumbnail %} - {% endblock %} + {% endblock thumbnail %}
{% block details %} - {% endblock %} + {% endblock details %}
- {% endblock %} + {% endblock details_left %}
{% block details_right %} block details_right - {% endblock %} + {% endblock details_right %}
+ {% block details_below %} + {% endblock details_below %}
{% endblock %} From a2d912d3744e1da68dc0c4f1470c66978c101abc Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 30 Nov 2021 19:45:37 +1100 Subject: [PATCH 03/25] Bootstrappy collapse --- InvenTree/part/templates/part/part_base.html | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/InvenTree/part/templates/part/part_base.html b/InvenTree/part/templates/part/part_base.html index 4e85853e69..8c72557d27 100644 --- a/InvenTree/part/templates/part/part_base.html +++ b/InvenTree/part/templates/part/part_base.html @@ -146,8 +146,7 @@
{% include "spacer.html" %} -
@@ -255,7 +254,7 @@ {% block details_below %} -
+
@@ -563,4 +562,12 @@ }); {% endif %} + $('#collapse-part-details').on('show.bs.collapse', function() { + $('#toggle-details-button').html('{% trans "Hide Part Details" %}'); + }); + + $('#collapse-part-details').on('hide.bs.collapse', function() { + $('#toggle-details-button').html('{% trans "Show Part Details" %}'); + }); + {% endblock %} \ No newline at end of file From 5049f17d0b026dc03e592b330062f7306ca614ae Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 30 Nov 2021 19:49:04 +1100 Subject: [PATCH 04/25] Save toggle state to session --- InvenTree/part/templates/part/part_base.html | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/InvenTree/part/templates/part/part_base.html b/InvenTree/part/templates/part/part_base.html index 8c72557d27..9619a55b38 100644 --- a/InvenTree/part/templates/part/part_base.html +++ b/InvenTree/part/templates/part/part_base.html @@ -562,12 +562,20 @@ }); {% endif %} + // Callback function when the "part details" panel is shown $('#collapse-part-details').on('show.bs.collapse', function() { $('#toggle-details-button').html('{% trans "Hide Part Details" %}'); + inventreeSave('show-part-details', true); }); + // Callback function when the "part details" panel is hidden $('#collapse-part-details').on('hide.bs.collapse', function() { $('#toggle-details-button').html('{% trans "Show Part Details" %}'); + inventreeSave('show-part-details', false); }); + if (inventreeLoad('show-part-details', false).toString() == 'true') { + $('#collapse-part-details').collapse('show'); + } + {% endblock %} \ No newline at end of file From 3aad2eb13d680473b8714e0a34c3f7c75c8bea8b Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 30 Nov 2021 19:57:07 +1100 Subject: [PATCH 05/25] Refactor title card for "location" view --- InvenTree/stock/templates/stock/location.html | 41 +++++++++++++------ 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/InvenTree/stock/templates/stock/location.html b/InvenTree/stock/templates/stock/location.html index 18b78b2290..c956508d76 100644 --- a/InvenTree/stock/templates/stock/location.html +++ b/InvenTree/stock/templates/stock/location.html @@ -11,7 +11,7 @@ {% if location %} {% trans "Stock Location" %}: {{ location.name }} {% else %} -{% trans "Stock" %} +{% trans "Stock Location" %} {% endif %} {% endblock %} @@ -80,12 +80,32 @@ {% endblock %} {% block details_left %} -{% if location %} -

{{ location.description }}

-{% else %} -

{% trans "Top level stock location" %}

-{% endif %} + + + {% if location %} + {% if location.description %} + + + + + + {% endif %} + + + + + + {% else %} + + + + + + {% endif %} +
{% trans "Description" %}{{ location.description }}
{% trans "Location Path" %}{{ location.pathstring }}
{% trans "Location Path" %}{% trans "Top level stock location" %}
+{% endblock details_left %} +{% block details_below %} {% setting_object 'STOCK_OWNERSHIP_CONTROL' as owner_control %} {% if owner_control.value == "True" %} {% authorized_owners location.owner as owners %} @@ -97,17 +117,12 @@ {% endif %} {% endif %} -{% endblock %} +{% endblock details_below %} {% block details_right %} {% if location %} - - - - - @@ -134,7 +149,7 @@
{% trans "Description" %}{{ location.description }}
{% trans "Sublocations" %}
{% endif %} -{% endblock %} +{% endblock details_right %} {% block page_content %} From 440436c70d0b16856cf6609049eed358a24cf96a Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 30 Nov 2021 20:00:26 +1100 Subject: [PATCH 06/25] Refactor display for "part category" --- InvenTree/part/templates/part/category.html | 43 +++++++++++-------- InvenTree/stock/templates/stock/location.html | 2 +- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/InvenTree/part/templates/part/category.html b/InvenTree/part/templates/part/category.html index bc8a99a3dd..9e6a923dda 100644 --- a/InvenTree/part/templates/part/category.html +++ b/InvenTree/part/templates/part/category.html @@ -61,29 +61,36 @@ {% endblock %} {% block details_left %} -{% if category %} -

{{ category.description }}

-{% else %} -

{% trans "Top level part category" %}

-{% endif %} - -{% endblock %} + + + {% if category %} + {% if category.description %} + + + + + + {% endif %} + + + + + + {% else %} + + + + + + {% endif %} +
{% trans "Description" %}{{ category.description }}
{% trans "Category Path" %}{{ category.pathstring }}
{% trans "Category Path" %}{% trans "Top level part category" %}
+{% endblock details_left %} {% block details_right %} {% if category %} - - - - - - - - - - {% if category.default_location %} @@ -124,7 +131,7 @@
{% trans "Category Path" %}{{ category.pathstring }}
{% trans "Category Description" %}{{ category.description }}
{% endif %} -{% endblock %} +{% endblock details_right %} {% block page_content %} diff --git a/InvenTree/stock/templates/stock/location.html b/InvenTree/stock/templates/stock/location.html index c956508d76..6a201e610c 100644 --- a/InvenTree/stock/templates/stock/location.html +++ b/InvenTree/stock/templates/stock/location.html @@ -11,7 +11,7 @@ {% if location %} {% trans "Stock Location" %}: {{ location.name }} {% else %} -{% trans "Stock Location" %} +{% trans "Stock" %} {% endif %} {% endblock %} From 64abe1e889ea7123dc385fad191aa0224d5e4717 Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 30 Nov 2021 20:31:05 +1100 Subject: [PATCH 07/25] Refactoring "company" view --- .../templates/company/company_base.html | 40 ++++--- InvenTree/part/templates/part/category.html | 14 +-- InvenTree/part/templates/part/part_base.html | 108 +++++++++--------- .../stock/templates/stock/item_base.html | 2 - 4 files changed, 86 insertions(+), 78 deletions(-) diff --git a/InvenTree/company/templates/company/company_base.html b/InvenTree/company/templates/company/company_base.html index b9cd650395..e19e8e4e37 100644 --- a/InvenTree/company/templates/company/company_base.html +++ b/InvenTree/company/templates/company/company_base.html @@ -56,7 +56,29 @@ {% endblock %} {% block details %} -

{{ company.description }}

+ + + + + + + + + + + + + + + + + + + + + + +
{% trans "Description" %}{{ company.description }}
{%trans "Manufacturer" %}{% include "yesnolabel.html" with value=company.is_manufacturer %}
{% trans "Supplier" %}{% include 'yesnolabel.html' with value=company.is_supplier %}
{% trans "Customer" %}{% include 'yesnolabel.html' with value=company.is_customer %}
{% endblock %} @@ -110,22 +132,6 @@ {{ company.contact }}{% include "clip.html"%} {% endif %} - - - - {%trans "Manufacturer" %} - {% include "yesnolabel.html" with value=company.is_manufacturer %} - - - - {% trans "Supplier" %} - {% include 'yesnolabel.html' with value=company.is_supplier %} - - - - {% trans "Customer" %} - {% include 'yesnolabel.html' with value=company.is_customer %} - {% endblock %} diff --git a/InvenTree/part/templates/part/category.html b/InvenTree/part/templates/part/category.html index 9e6a923dda..4797571fda 100644 --- a/InvenTree/part/templates/part/category.html +++ b/InvenTree/part/templates/part/category.html @@ -76,6 +76,13 @@ {% trans "Category Path" %} {{ category.pathstring }} + {% if category.default_keywords %} + + + {% trans "Keywords" %} + {{ category.default_keywords }} + + {% endif %} {% else %} @@ -98,13 +105,6 @@ {{ category.default_location.pathstring }} {% endif %} - {% if category.default_keywords %} - - - {% trans "Keywords" %} - {{ category.default_keywords }} - - {% endif %} {% trans "Subcategories" %} diff --git a/InvenTree/part/templates/part/part_base.html b/InvenTree/part/templates/part/part_base.html index 9619a55b38..581b796352 100644 --- a/InvenTree/part/templates/part/part_base.html +++ b/InvenTree/part/templates/part/part_base.html @@ -100,60 +100,64 @@ {% block details %} -

-
-
- {% if part.is_template %} -   - - {% endif %} - {% if part.assembly %} -   - - {% endif %} - {% if part.component %} -   - - {% endif %} - {% if part.trackable %} -   - - {% endif %} - {% if part.purchaseable %} -   - - {% endif %} - {% if part.salable %} -   - - {% endif %} - - {% if not part.active %} -   -
- - {% trans 'Inactive' %} -
- {% endif %} - - {% if part.virtual and part.active %} -   -
- - {% trans 'Virtual' %} -
- {% endif %} -
- - {% include "spacer.html" %} - -
-

- + + + diff --git a/InvenTree/stock/templates/stock/item_base.html b/InvenTree/stock/templates/stock/item_base.html index 111007cd71..37ff88073b 100644 --- a/InvenTree/stock/templates/stock/item_base.html +++ b/InvenTree/stock/templates/stock/item_base.html @@ -148,8 +148,6 @@ {% endif %} - -
{% setting_object 'STOCK_OWNERSHIP_CONTROL' as owner_control %} From 7b43e3e585ab5ae1f9a8a74acda7fde7148ac8c6 Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 30 Nov 2021 20:33:41 +1100 Subject: [PATCH 08/25] Refactor sales order page --- .../templates/order/sales_order_base.html | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/InvenTree/order/templates/order/sales_order_base.html b/InvenTree/order/templates/order/sales_order_base.html index 368c3a2e47..12c0eec8f7 100644 --- a/InvenTree/order/templates/order/sales_order_base.html +++ b/InvenTree/order/templates/order/sales_order_base.html @@ -72,13 +72,19 @@ src="{% static 'img/blank_image.png' %}" {% block details %} -

- {% sales_order_status_label order.status large=True %} - {% if order.is_overdue %} - {% trans "Overdue" %} - {% endif %} -

-

{{ order.description }}{% include "clip.html"%}

+
+
+
+
+ {% if part.is_template %} +   + + {% endif %} + {% if part.assembly %} +   + + {% endif %} + {% if part.component %} +   + + {% endif %} + {% if part.trackable %} +   + + {% endif %} + {% if part.purchaseable %} +   + + {% endif %} + {% if part.salable %} +   + + {% endif %} + + {% if not part.active %} +   +
+ + {% trans 'Inactive' %} +
+ {% endif %} + + {% if part.virtual and part.active %} +   +
+ + {% trans 'Virtual' %} +
+ {% endif %} +
+
+ + {% include "spacer.html" %} + + +
+
{% trans "Part Name" %}
+ + + + + + + + + + + +
{% trans "Order Reference" %}{% settings_value 'SALESORDER_REFERENCE_PREFIX' %}{{ order.reference }}{% include "clip.html"%}
{% trans "Order Description" %}{{ order.description }}{% include "clip.html" %}
{% if order.status == SalesOrderStatus.PENDING and not order.is_fully_allocated %} @@ -93,11 +99,6 @@ src="{% static 'img/blank_image.png' %}" {% block details_right %} - - - - - From fd021978515e149d1b3c15eda78b2803f9e43148 Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 30 Nov 2021 20:39:28 +1100 Subject: [PATCH 09/25] Refactor purchase order page --- .../order/templates/order/order_base.html | 38 ++++++++++--------- .../order/purchase_order_detail.html | 2 +- .../templates/order/sales_order_base.html | 22 +++++------ 3 files changed, 33 insertions(+), 29 deletions(-) diff --git a/InvenTree/order/templates/order/order_base.html b/InvenTree/order/templates/order/order_base.html index 42733d1178..da78b83561 100644 --- a/InvenTree/order/templates/order/order_base.html +++ b/InvenTree/order/templates/order/order_base.html @@ -53,15 +53,17 @@ {% elif order.status == PurchaseOrderStatus.PLACED %} - - {% endif %} {% endif %} -{% endblock %} +{% endblock actions %} {% block thumbnail %} - {% purchase_order_status_label order.status large=True %} - {% if order.is_overdue %} - {% trans "Overdue" %} - {% endif %} - -

{{ order.description }}{% include "clip.html"%}

- -{% endblock %} - -{% block details_right %} -
{% trans "Order Reference" %}{% settings_value 'SALESORDER_REFERENCE_PREFIX' %}{{ order.reference }}{% include "clip.html"%}
{% trans "Order Status" %}
+
+ + + + + @@ -103,6 +99,14 @@ src="{% static 'img/blank_image.png' %}" {% endif %} + +
{% trans "Order Reference" %} {% settings_value 'PURCHASEORDER_REFERENCE_PREFIX' %}{{ order.reference }}{% include "clip.html"%}
{% trans "Order Description" %}{{ order.description }}{% include "clip.html" %}
{% trans "Order Status" %}
+ +{% endblock %} + +{% block details_right %} + + diff --git a/InvenTree/order/templates/order/purchase_order_detail.html b/InvenTree/order/templates/order/purchase_order_detail.html index 3a6ea090d5..90a105caf1 100644 --- a/InvenTree/order/templates/order/purchase_order_detail.html +++ b/InvenTree/order/templates/order/purchase_order_detail.html @@ -27,7 +27,7 @@ {% trans "Add Line Item" %} {% elif order.status == PurchaseOrderStatus.PLACED %} - {% endif %} diff --git a/InvenTree/order/templates/order/sales_order_base.html b/InvenTree/order/templates/order/sales_order_base.html index 12c0eec8f7..2a5a79a161 100644 --- a/InvenTree/order/templates/order/sales_order_base.html +++ b/InvenTree/order/templates/order/sales_order_base.html @@ -68,7 +68,7 @@ src="{% static 'img/blank_image.png' %}" {% endif %} {% endif %} -{% endblock %} +{% endblock actions %} {% block details %} @@ -84,6 +84,16 @@ src="{% static 'img/blank_image.png' %}" + + + + +
{% trans "Supplier" %}{% trans "Order Description" %} {{ order.description }}{% include "clip.html" %}
{% trans "Order Status" %} + {% sales_order_status_label order.status %} + {% if order.is_overdue %} + {% trans "Overdue" %} + {% endif %} +
@@ -99,16 +109,6 @@ src="{% static 'img/blank_image.png' %}" {% block details_right %} - - - - - {% if order.customer %} From defe80e2af39792cbcae5a36f14ad0d92a8eb690 Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 30 Nov 2021 20:45:18 +1100 Subject: [PATCH 10/25] Refactor build order display --- .../build/templates/build/build_base.html | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/InvenTree/build/templates/build/build_base.html b/InvenTree/build/templates/build/build_base.html index 22a126fcdf..428e40649f 100644 --- a/InvenTree/build/templates/build/build_base.html +++ b/InvenTree/build/templates/build/build_base.html @@ -12,7 +12,7 @@ {% block breadcrumbs %} -{% endblock %} +{% endblock breadcrumbs %} {% block thumbnail %} -{% endblock %} +{% endblock thumbnail %} {% block heading %} {% trans "Build Order" %} {{ build }} @@ -66,11 +66,23 @@ src="{% static 'img/blank_image.png' %}" {% endif %} {% endif %} -{% endblock %} +{% endblock actions %} {% block details %} -

{{ build.title }}

+
{% trans "Order Status" %} - {% sales_order_status_label order.status %} - {% if order.is_overdue %} - {% trans "Overdue" %} - {% endif %} -
+ + + + + + + + + + + +
{% trans "Part" %}{{ build.part.full_name }}
{% trans "Build Description" %}{{ build.title }}
{% if build.sales_order %} @@ -114,11 +126,7 @@ src="{% static 'img/blank_image.png' %}" {% block details_right %} - - - - - + From 1ce1710c5095969e2ecff732158e4e7264abb444 Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 30 Nov 2021 20:49:52 +1100 Subject: [PATCH 11/25] Refactor manufacturer part display --- .../templates/company/manufacturer_part.html | 84 ++++++++++--------- 1 file changed, 45 insertions(+), 39 deletions(-) diff --git a/InvenTree/company/templates/company/manufacturer_part.html b/InvenTree/company/templates/company/manufacturer_part.html index fcfa22ee2d..84e8016a59 100644 --- a/InvenTree/company/templates/company/manufacturer_part.html +++ b/InvenTree/company/templates/company/manufacturer_part.html @@ -8,7 +8,7 @@ InvenTree | {% trans "Manufacturer Part" %} {% block sidebar %} {% include "company/manufacturer_part_sidebar.html" %} -{% endblock %} +{% endblock sidebar %} {% block breadcrumbs %} @@ -16,13 +16,13 @@ InvenTree | {% trans "Manufacturer Part" %} {% endif %} -{% endblock %} +{% endblock breadcrumbs %} {% block heading %}

{% trans "Manufacturer Part" %}: {{ part.part.full_name }}

-{% endblock %} +{% endblock heading %} {% block actions %} {% if user.is_staff and perms.company.change_company %} @@ -46,7 +46,7 @@ InvenTree | {% trans "Manufacturer Part" %} {% endif %} {% endif %} -{% endblock %} +{% endblock actions %} {% block thumbnail %} -{% endblock %} +{% endblock thumbnail %} {% block details %} -{% endblock %} +
{% trans "Part" %}{{ build.part.full_name }}
{% trans "Quantity" %}
+ + + + + + + {% if part.description %} + + + + + + {% endif %} +
{% trans "Internal Part" %} + {% if part.part %} + {{ part.part.full_name }}{% include "clip.html"%} + {% endif %} +
{% trans "Description" %}{{ part.description }}{% include "clip.html"%}
+ +{% endblock details %} {% block details_right %} - - - - - - {% if part.description %} - - - - - - {% endif %} - {% if part.link %} - - - - - - {% endif %} - - - - - - - - - + + + + + + + + + + + + {% if part.link %} + + + + + + {% endif %}
{% trans "Internal Part" %} - {% if part.part %} - {{ part.part.full_name }}{% include "clip.html"%} - {% endif %} -
{% trans "Description" %}{{ part.description }}{% include "clip.html"%}
{% trans "External Link" %}{{ part.link }}{% include "clip.html"%}
{% trans "Manufacturer" %}{{ part.manufacturer.name }}{% include "clip.html"%}
{% trans "MPN" %}{{ part.MPN }}{% include "clip.html"%}
{% trans "Manufacturer" %}{{ part.manufacturer.name }}{% include "clip.html"%}
{% trans "MPN" %}{{ part.MPN }}{% include "clip.html"%}
{% trans "External Link" %}{{ part.link }}{% include "clip.html"%}
-{% endblock %} +{% endblock details_right %} {% block page_content %} From e88ea8d15723accd2505346802c0b5fbe600a409 Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 30 Nov 2021 20:53:01 +1100 Subject: [PATCH 12/25] Refactor supplier part display --- .../templates/company/supplier_part.html | 64 +++++++++---------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/InvenTree/company/templates/company/supplier_part.html b/InvenTree/company/templates/company/supplier_part.html index 276a9f7ebc..89e8f91493 100644 --- a/InvenTree/company/templates/company/supplier_part.html +++ b/InvenTree/company/templates/company/supplier_part.html @@ -5,11 +5,11 @@ {% block page_title %} {% inventree_title %} | {% trans "Supplier Part" %} -{% endblock %} +{% endblock page_title %} {% block sidebar %} {% include "company/supplier_part_sidebar.html" %} -{% endblock %} +{% endblock sidebar %} {% block breadcrumbs %} @@ -17,13 +17,13 @@ {% endif %} -{% endblock %} +{% endblock breadcrumbs %} {% block heading %}

{% trans "Supplier Part" %}: {{ part.SKU }}

-{% endblock %} +{% endblock heading %} {% block actions %} {% if user.is_staff and perms.company.change_company %} @@ -43,7 +43,7 @@ {% endif %} -{% endblock %} +{% endblock actions %} {% block thumbnail %} - {{ part.part.full_name }} -

+ + + + + + + + {% if part.description %} + + + + + + {% endif %} +
{% trans "Internal Part" %} + {% if part.part %} + {{ part.part.full_name }}{% include "clip.html"%} + {% endif %} +
{% trans "Description" %}{{ part.description }}{% include "clip.html"%}
-{% endblock %} +{% endblock details %} {% block details_right %} - - - - - - {% if part.description %} - - - - - - {% endif %} - {% if part.link %} - - - - - - {% endif %} @@ -127,6 +120,13 @@ src="{% static 'img/blank_image.png' %}" {% endif %} + {% if part.link %} + + + + + + {% endif %}
{% trans "Internal Part" %} - {% if part.part %} - {{ part.part.full_name }}{% include "clip.html"%} - {% endif %} -
{% trans "Description" %}{{ part.description }}{% include "clip.html"%}
{% trans "External Link" %}{{ part.link }}{% include "clip.html"%}
{% trans "Supplier" %}{{ part.note }}{% include "clip.html"%}
{% trans "External Link" %}{{ part.link }}{% include "clip.html"%}
{% endblock %} From 91c8d9fee35d8d75733d1007449c129adf04a414 Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 30 Nov 2021 20:59:37 +1100 Subject: [PATCH 13/25] Refactor stock item view --- .../stock/templates/stock/item_base.html | 174 ++++++++---------- 1 file changed, 81 insertions(+), 93 deletions(-) diff --git a/InvenTree/stock/templates/stock/item_base.html b/InvenTree/stock/templates/stock/item_base.html index 37ff88073b..e969ac482f 100644 --- a/InvenTree/stock/templates/stock/item_base.html +++ b/InvenTree/stock/templates/stock/item_base.html @@ -14,7 +14,7 @@ {% block heading %} {% trans "Stock Item" %}: {{ item.part.full_name}} -{% endblock %} +{% endblock heading %} {% block actions %} @@ -118,36 +118,94 @@
{% endif %} {% endif %} -{% endblock %} +{% endblock actions %} {% block thumbnail %} -{% endblock %} +{% endblock thumbnail %} {% block details %} + + + + + + + + {% if item.serialized %} + + + + + + {% else %} + + + + + + {% endif %} + + + + + + {% if item.expiry_date %} + + + + + + {% endif %} + + + + + + + + + {% if item.stocktake_date %} + + {% else %} + + {% endif %} + +
{% trans "Base Part" %} + {% if roles.part.view %} + + {% endif %} + {{ item.part.full_name }} + {% if roles.part.view %} + + {% endif %} +
{% trans "Serial Number" %} + {% if previous %} + + {{ previous.serial }} ‹ + + {% endif %} + {{ item.serial }} + {% if next %} + + › {{ next.serial }} + + {% endif %} +
{% trans "Quantity" %}{% decimal item.quantity %} {% if item.part.units %}{{ item.part.units }}{% endif %}
{% trans "Status" %}{% stock_status_label item.status %}
{% trans "Expiry Date" %} + {{ item.expiry_date }} + {% if item.is_expired %} + {% trans "Expired" %} + {% elif item.is_stale %} + {% trans "Stale" %} + {% endif %} +
{% trans "Last Updated" %}{{ item.updated }}
{% trans "Last Stocktake" %}{{ item.stocktake_date }} {{ item.stocktake_user }}{% trans "No stocktake performed" %}
+ {% setting_object 'STOCK_OWNERSHIP_CONTROL' as owner_control %} {% if owner_control.value == "True" %} {% authorized_owners item.owner as owners %} {% endif %} -

- {% if item.is_expired %} - {% trans "Expired" %} - {% else %} - {% if roles.stock.change %} - - {% endif %} - {% stock_status_label item.status large=True %} - {% if roles.stock.change %} - - {% endif %} - {% if item.is_stale %} - {% trans "Stale" %} - {% endif %} - {% endif %} -

-
{% setting_object 'STOCK_OWNERSHIP_CONTROL' as owner_control %} @@ -212,49 +270,12 @@ {% endif %}
-{% endblock %} +{% endblock details %} {% block details_right %} - +
- - - - - - {% if item.serialized %} - - - - - - {% else %} - - - - - - {% endif %} + {% if item.customer %} @@ -374,39 +395,6 @@ {% endif %} - {% if item.expiry_date %} - - - - - - {% endif %} - - - - - - - - - {% if item.stocktake_date %} - - {% else %} - - {% endif %} - - - - - - {% if item.hasRequiredTests %} From c01c0b0e25f29e62f539c613751238bc1ee8fc94 Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 30 Nov 2021 21:13:55 +1100 Subject: [PATCH 14/25] Refactor company buttons --- .../templates/company/company_base.html | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/InvenTree/company/templates/company/company_base.html b/InvenTree/company/templates/company/company_base.html index e19e8e4e37..3903dba685 100644 --- a/InvenTree/company/templates/company/company_base.html +++ b/InvenTree/company/templates/company/company_base.html @@ -19,21 +19,26 @@ {% include "admin_button.html" with url=url %} {% endif %} {% if company.is_supplier and roles.purchase_order.add %} - {% endif %} -{% if perms.company.change_company %} - -{% endif %} -{% if perms.company.delete_company %} - -{% endif %} -{% endblock %} + +{% endblock actions %} {% block thumbnail %}
From a2a436ea693708368dce2bb205ecb29cc719ec94 Mon Sep 17 00:00:00 2001 From: Oliver Date: Wed, 1 Dec 2021 08:05:30 +1100 Subject: [PATCH 15/25] Column improvements --- InvenTree/part/templates/part/part_base.html | 5 --- .../stock/templates/stock/item_base.html | 4 +- InvenTree/templates/page_base.html | 44 ++++++++++--------- 3 files changed, 26 insertions(+), 27 deletions(-) diff --git a/InvenTree/part/templates/part/part_base.html b/InvenTree/part/templates/part/part_base.html index 581b796352..994eefe94e 100644 --- a/InvenTree/part/templates/part/part_base.html +++ b/InvenTree/part/templates/part/part_base.html @@ -158,11 +158,6 @@
- - - - - diff --git a/InvenTree/stock/templates/stock/item_base.html b/InvenTree/stock/templates/stock/item_base.html index e969ac482f..5f22076d9a 100644 --- a/InvenTree/stock/templates/stock/item_base.html +++ b/InvenTree/stock/templates/stock/item_base.html @@ -100,7 +100,9 @@ {% if roles.stock.change and not item.is_building %}
- +
{% else %} From 98bbee81597fc00baafa854c683ae936dfd0dafc Mon Sep 17 00:00:00 2001 From: Oliver Date: Thu, 2 Dec 2021 15:55:00 +1100 Subject: [PATCH 24/25] Adds function to lookup stock item by serial number --- InvenTree/InvenTree/version.py | 6 +- InvenTree/stock/api.py | 14 +++- .../stock/templates/stock/item_base.html | 4 + InvenTree/templates/js/translated/stock.js | 82 +++++++++++++++++++ 4 files changed, 104 insertions(+), 2 deletions(-) diff --git a/InvenTree/InvenTree/version.py b/InvenTree/InvenTree/version.py index e0e64f5525..bbf0174453 100644 --- a/InvenTree/InvenTree/version.py +++ b/InvenTree/InvenTree/version.py @@ -12,11 +12,15 @@ import common.models INVENTREE_SW_VERSION = "0.6.0 dev" # InvenTree API version -INVENTREE_API_VERSION = 18 +INVENTREE_API_VERSION = 19 """ Increment this API version number whenever there is a significant change to the API that any clients need to know about +v19 -> 2021-12-02 + - Adds the ability to filter the StockItem API by "part_tree" + - Returns only stock items which match a particular part.tree_id field + v18 -> 2021-11-15 - Adds the ability to filter BomItem API by "uses" field - This returns a list of all BomItems which "use" the specified part diff --git a/InvenTree/stock/api.py b/InvenTree/stock/api.py index fcfa58d01a..8385041209 100644 --- a/InvenTree/stock/api.py +++ b/InvenTree/stock/api.py @@ -313,7 +313,7 @@ class StockFilter(rest_filters.FilterSet): # Serial number filtering serial_gte = rest_filters.NumberFilter(label='Serial number GTE', field_name='serial', lookup_expr='gte') serial_lte = rest_filters.NumberFilter(label='Serial number LTE', field_name='serial', lookup_expr='lte') - serial = rest_filters.NumberFilter(label='Serial number', field_name='serial', lookup_expr='exact') + serial = rest_filters.CharFilter(label='Serial number', field_name='serial', lookup_expr='exact') serialized = rest_filters.BooleanFilter(label='Has serial number', method='filter_serialized') @@ -703,6 +703,18 @@ class StockList(generics.ListCreateAPIView): except (ValueError, StockItem.DoesNotExist): pass + # Filter by "part tree" - only allow parts within a given variant tree + part_tree = params.get('part_tree', None) + + if part_tree is not None: + try: + part = Part.objects.get(pk=part_tree) + + if part.tree_id is not None: + queryset = queryset.filter(part__tree_id=part.tree_id) + except: + pass + # Filter by 'allocated' parts? allocated = params.get('allocated', None) diff --git a/InvenTree/stock/templates/stock/item_base.html b/InvenTree/stock/templates/stock/item_base.html index ac6753e565..0d5ab272d6 100644 --- a/InvenTree/stock/templates/stock/item_base.html +++ b/InvenTree/stock/templates/stock/item_base.html @@ -599,4 +599,8 @@ $("#stock-return-from-customer").click(function() { {% endif %} +$('#serial-number-search').click(function() { + findStockItemBySerialNumber({{ item.part.pk }}); +}); + {% endblock %} diff --git a/InvenTree/templates/js/translated/stock.js b/InvenTree/templates/js/translated/stock.js index 5e92299f03..02ea3c2c3b 100644 --- a/InvenTree/templates/js/translated/stock.js +++ b/InvenTree/templates/js/translated/stock.js @@ -44,6 +44,7 @@ editStockItem, editStockLocation, exportStock, + findStockItemBySerialNumber, loadInstalledInTable, loadStockLocationTable, loadStockTable, @@ -394,6 +395,87 @@ function createNewStockItem(options={}) { constructForm(url, options); } +/* + * Launch a modal form to find a particular stock item by serial number. + * Arguments: + * - part: ID (PK) of the part in question + */ + +function findStockItemBySerialNumber(part_id) { + + constructFormBody({}, { + title: '{% trans "Find Serial Number" %}', + fields: { + serial: { + label: '{% trans "Serial Number" %}', + help_text: '{% trans "Enter serial number" %}', + placeholder: '{% trans "Enter serial number" %}', + required: true, + type: 'string', + value: '', + } + }, + onSubmit: function(fields, opts) { + + var serial = getFormFieldValue('serial', fields['serial'], opts); + + serial = serial.toString().trim(); + + if (!serial) { + handleFormErrors( + { + 'serial': [ + '{% trans "Enter a serial number" %}', + ] + }, fields, opts + ); + return; + } + + inventreeGet( + '{% url "api-stock-list" %}', + { + part_tree: part_id, + serial: serial, + }, + { + success: function(response) { + if (response.length == 0) { + // No results! + handleFormErrors( + { + 'serial': [ + '{% trans "No matching serial number" %}', + ] + }, fields, opts + ); + } else if (response.length > 1) { + // Too many results! + handleFormErrors( + { + 'serial': [ + '{% trans "More than one matching result found" %}', + ] + }, fields, opts + ); + } else { + $(opts.modal).modal('hide'); + + // Redirect + var pk = response[0].pk; + location.href = `/stock/item/${pk}/`; + } + }, + error: function(xhr) { + showApiError(xhr, opts.url); + $(opts.modal).modal('hide'); + } + } + ); + } + }); +} + /* Stock API functions * Requires api.js to be loaded first From e96ff7fbbaaa3c086493aacb3d300c2dcd3ebf0c Mon Sep 17 00:00:00 2001 From: Oliver Date: Thu, 2 Dec 2021 16:01:28 +1100 Subject: [PATCH 25/25] Add lookup-by-sn on part page, too --- InvenTree/part/templates/part/part_base.html | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/InvenTree/part/templates/part/part_base.html b/InvenTree/part/templates/part/part_base.html index 994eefe94e..d2505a57f7 100644 --- a/InvenTree/part/templates/part/part_base.html +++ b/InvenTree/part/templates/part/part_base.html @@ -322,7 +322,14 @@ - + {% endif %} {% if part.default_location %} @@ -577,4 +584,8 @@ $('#collapse-part-details').collapse('show'); } + $('#serial-number-search').click(function() { + findStockItemBySerialNumber({{ part.pk }}); + }); + {% endblock %} \ No newline at end of file
{% trans "Base Part" %} - {% if roles.part.view %} - - {% endif %} - {{ item.part.full_name }} - {% if roles.part.view %} - - {% endif %} -
{% trans "Serial Number" %} - {% if previous %} - - {{ previous.serial }} ‹ - - {% endif %} - {{ item.serial }} - {% if next %} - - › {{ next.serial }} - - {% endif %} -
{% trans "Quantity" %}{% decimal item.quantity %} {% if item.part.units %}{{ item.part.units }}{% endif %}
{{ item.supplier_part.SKU }}
{% trans "Expiry Date" %} - {{ item.expiry_date }} - {% if item.is_expired %} - {% trans "Expired" %} - {% elif item.is_stale %} - {% trans "Stale" %} - {% endif %} -
{% trans "Last Updated" %}{{ item.updated }}
{% trans "Last Stocktake" %}{{ item.stocktake_date }} {{ item.stocktake_user }}{% trans "No stocktake performed" %}
{% trans "Status" %}{% stock_status_label item.status %}
{% trans "Part Name" %}{{ part.full_name }}{% include "clip.html"%}
{% trans "Description" %} {% trans "Serial Number" %} - {% if previous %} - - {{ previous.serial }} ‹ - - {% endif %} - {{ item.serial }} - {% if next %} - - › {{ next.serial }} - - {% endif %} + {{ item.serial }} +
+ {% if previous %} + + + {{ previous.serial }} + + {% endif %} + + + + {% if next %} + + {{ next.serial }} + + + {% endif %} +
{% trans "Latest Serial Number" %}{{ part.getLatestSerialNumber }}{% include "clip.html"%} + {{ part.getLatestSerialNumber }} +
+ + + +
+