diff --git a/InvenTree/InvenTree/static/script/inventree/modals.js b/InvenTree/InvenTree/static/script/inventree/modals.js
index 80ada1596f..49de96468f 100644
--- a/InvenTree/InvenTree/static/script/inventree/modals.js
+++ b/InvenTree/InvenTree/static/script/inventree/modals.js
@@ -354,7 +354,7 @@ function renderErrorMessage(xhr) {
var html = '' + xhr.statusText + '
';
- html += 'Status Code - ' + xhr.status + '
@@ -811,16 +811,37 @@ function launchModalForm(url, options = {}) {
$(modal).modal('hide');
// Permission denied!
- if (xhr.status == 403) {
+ if (xhr.status == 400) {
showAlertDialog(
- "Permission Denied",
+ "Error 400: Bad Request",
+ "Server returned error code 400"
+ );
+ } else if (xhr.status == 401) {
+ showAlertDialog(
+ "Error 401: Not Authenticated",
+ "Authentication credentials not supplied"
+ );
+ } else if (xhr.status == 403) {
+ showAlertDialog(
+ "Error 403: Permission Denied",
"You do not have the required permissions to access this function"
);
-
- return;
+ } else if (xhr.status == 404) {
+ showAlertDialog(
+ "Error 404: Resource Not Found",
+ "The requested resource could not be located on the server"
+ );
+ } else if (xhr.status == 408) {
+ showAlertDialog(
+ "Error 408: Timeout",
+ "Connection timeout while requesting data from server"
+ );
+ } else {
+ showAlertDialog('Error requesting form data', renderErrorMessage(xhr));
}
- showAlertDialog('Error requesting form data', renderErrorMessage(xhr));
+ console.log("Modal form error: " + xhr.status);
+ console.log("Message: " + xhr.responseText);
}
};
diff --git a/InvenTree/company/models.py b/InvenTree/company/models.py
index 2a8d907b76..f1e249fd58 100644
--- a/InvenTree/company/models.py
+++ b/InvenTree/company/models.py
@@ -423,12 +423,16 @@ 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 += ' | '
+
+ 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/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 @@
-
- {% trans "Items" %}
+ {% trans "Line Items" %}
+
+ -
+ {% trans "Received Items" %}
-
{% trans "Attachments" %}
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 %}
diff --git a/InvenTree/order/urls.py b/InvenTree/order/urls.py
index 22104df5c7..7707b73f37 100644
--- a/InvenTree/order/urls.py
+++ b/InvenTree/order/urls.py
@@ -21,6 +21,7 @@ purchase_order_detail_urls = [
url(r'^notes/', views.PurchaseOrderNotes.as_view(), name='po-notes'),
+ url(r'^received/', views.PurchaseOrderDetail.as_view(template_name='order/po_received_items.html'), name='po-received'),
url(r'^attachments/', views.PurchaseOrderDetail.as_view(template_name='order/po_attachments.html'), name='po-attachments'),
url(r'^.*$', views.PurchaseOrderDetail.as_view(), name='po-detail'),
]
diff --git a/InvenTree/stock/api.py b/InvenTree/stock/api.py
index ab70c98322..dabeaa20ea 100644
--- a/InvenTree/stock/api.py
+++ b/InvenTree/stock/api.py
@@ -498,6 +498,11 @@ class StockList(generics.ListCreateAPIView):
if sales_order:
queryset = queryset.filter(sales_order=sales_order)
+ purchase_order = params.get('purchase_order', None)
+
+ if purchase_order is not None:
+ queryset = queryset.filter(purchase_order=purchase_order)
+
# Filter stock items which are installed in another (specific) stock item
installed_in = params.get('installed_in', None)
diff --git a/InvenTree/stock/templates/stock/item_base.html b/InvenTree/stock/templates/stock/item_base.html
index 5197285379..d7eb987aab 100644
--- a/InvenTree/stock/templates/stock/item_base.html
+++ b/InvenTree/stock/templates/stock/item_base.html
@@ -228,7 +228,7 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}
{% if item.uid %}
|
- {% trans "Unique Identifier" %} |
+ {% trans "Barcode Identifier" %} |
{{ item.uid }} |
{% endif %}
diff --git a/InvenTree/templates/js/stock.html b/InvenTree/templates/js/stock.html
index eb5e4adbf7..f8388c3b62 100644
--- a/InvenTree/templates/js/stock.html
+++ b/InvenTree/templates/js/stock.html
@@ -262,7 +262,7 @@ function loadStockTable(table, options) {
formatNoMatches: function() {
return '{% trans "No stock items matching query" %}';
},
- url: options.url,
+ url: options.url || "{% url 'api-stock-list' %}",
queryParams: filters,
customSort: customGroupSorter,
groupBy: true,