From aaf27d409818c2b9a65ac48556a063bfdbf18adf Mon Sep 17 00:00:00 2001 From: Oliver Date: Wed, 3 Nov 2021 07:27:58 +1100 Subject: [PATCH] Adds new buttons to create a new stock item --- .../company/templates/company/supplier_part.html | 10 +++++++++- .../templates/order/purchase_order_detail.html | 2 +- InvenTree/part/templates/part/detail.html | 15 +++++++++++++-- InvenTree/stock/templates/stock/location.html | 10 +++++++++- InvenTree/templates/stock_table.html | 12 ++---------- 5 files changed, 34 insertions(+), 15 deletions(-) diff --git a/InvenTree/company/templates/company/supplier_part.html b/InvenTree/company/templates/company/supplier_part.html index 52742cf488..d3bee4e797 100644 --- a/InvenTree/company/templates/company/supplier_part.html +++ b/InvenTree/company/templates/company/supplier_part.html @@ -134,7 +134,15 @@ src="{% static 'img/blank_image.png' %}"
-

{% trans "Supplier Part Stock" %}

+ +

{% trans "Supplier Part Stock" %}

+ {% include "spacer.html" %} +
+ +
+
{% include "stock_table.html" %} diff --git a/InvenTree/order/templates/order/purchase_order_detail.html b/InvenTree/order/templates/order/purchase_order_detail.html index b0d9d7d301..257707347a 100644 --- a/InvenTree/order/templates/order/purchase_order_detail.html +++ b/InvenTree/order/templates/order/purchase_order_detail.html @@ -50,7 +50,7 @@

{% trans "Received Items" %}

- {% include "stock_table.html" with prevent_new_stock=True %} + {% include "stock_table.html" %}
diff --git a/InvenTree/part/templates/part/detail.html b/InvenTree/part/templates/part/detail.html index 145b5bfb35..3c75b128da 100644 --- a/InvenTree/part/templates/part/detail.html +++ b/InvenTree/part/templates/part/detail.html @@ -95,7 +95,15 @@
-

{% trans "Part Stock" %}

+
+

{% trans "Part Stock" %}

+ {% include "spacer.html" %} +
+ +
+
{% if part.is_template %} @@ -851,11 +859,14 @@ }); onPanelLoad("part-stock", function() { - $('#add-stock-item').click(function () { + $('#new-stock-item').click(function () { createNewStockItem({ reload: true, data: { part: {{ part.id }}, + {% if part.default_location %} + location: {{ part.default_location.pk }}, + {% endif %} } }); }); diff --git a/InvenTree/stock/templates/stock/location.html b/InvenTree/stock/templates/stock/location.html index 78b82b5093..bf3c5d1648 100644 --- a/InvenTree/stock/templates/stock/location.html +++ b/InvenTree/stock/templates/stock/location.html @@ -140,7 +140,15 @@
-

{% trans "Stock Items" %}

+
+

{% trans "Stock Items" %}

+ {% include "spacer.html" %} +
+ +
+
{% include "stock_table.html" %} diff --git a/InvenTree/templates/stock_table.html b/InvenTree/templates/stock_table.html index 912d2e16a5..71c6734818 100644 --- a/InvenTree/templates/stock_table.html +++ b/InvenTree/templates/stock_table.html @@ -10,17 +10,10 @@
-
+
- - {% if owner_control.value == "True" and user in owners or user.is_superuser or owner_control.value == "False" %} - {% if not read_only and not prevent_new_stock and roles.stock.add %} - - {% endif %} {% if barcodes %}
@@ -46,7 +39,7 @@
{% if not read_only %} {% if roles.stock.change or roles.stock.delete %} -
+
@@ -66,7 +59,6 @@
{% endif %} {% endif %} - {% endif %} {% include "filter_list.html" with id="stock" %}