diff --git a/InvenTree/company/templates/company/supplier_part_detail.html b/InvenTree/company/templates/company/supplier_part_detail.html
index 1e2b24c94b..bb0dee177a 100644
--- a/InvenTree/company/templates/company/supplier_part_detail.html
+++ b/InvenTree/company/templates/company/supplier_part_detail.html
@@ -35,9 +35,6 @@
{% endif %}
-
{% trans "Purchase Orders" %}
-{% include "order/po_table.html" with orders=part.purchase_orders %}
-
{% endblock %}
{% block js_ready %}
diff --git a/InvenTree/company/templates/company/supplier_part_orders.html b/InvenTree/company/templates/company/supplier_part_orders.html
new file mode 100644
index 0000000000..02d85b1d99
--- /dev/null
+++ b/InvenTree/company/templates/company/supplier_part_orders.html
@@ -0,0 +1,19 @@
+{% extends "company/supplier_part_base.html" %}
+{% load static %}
+{% load i18n %}
+
+{% block details %}
+
+{% include "company/supplier_part_tabs.html" with tab='orders' %}
+
+
+
+{% trans "Supplier Part Orders" %}
+
+{% include "order/po_table.html" with orders=part.purchase_orders %}
+
+{% endblock %}
+
+{% block js_ready %}
+{{ block.super }}
+{% endblock %}
\ No newline at end of file
diff --git a/InvenTree/company/templates/company/supplier_part_pricing.html b/InvenTree/company/templates/company/supplier_part_pricing.html
index 354b76db86..bed8d9ed35 100644
--- a/InvenTree/company/templates/company/supplier_part_pricing.html
+++ b/InvenTree/company/templates/company/supplier_part_pricing.html
@@ -7,6 +7,7 @@
{% 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
new file mode 100644
index 0000000000..f672d063a7
--- /dev/null
+++ b/InvenTree/company/templates/company/supplier_part_stock.html
@@ -0,0 +1,36 @@
+{% extends "company/supplier_part_base.html" %}
+{% load static %}
+{% load i18n %}
+
+{% block details %}
+
+{% include "company/supplier_part_tabs.html" with tab='stock' %}
+
+
+
+{% trans "Supplier Part Stock" %}
+
+{% include "stock_table.html" %}
+
+{% endblock %}
+
+{% block js_load %}
+{{ block.super }}
+
+{% endblock %}
+
+{% block js_ready %}
+{{ block.super }}
+
+ loadStockTable($("#stock-table"), {
+ params: {
+ supplier_part: {{ part.id }},
+ location_detail: true,
+ part_detail: true,
+ },
+ groupByField: 'location',
+ buttons: ['#stock-options'],
+ url: "{% url 'api-stock-list' %}",
+ });
+
+{% endblock %}
\ No newline at end of file
diff --git a/InvenTree/company/templates/company/supplier_part_tabs.html b/InvenTree/company/templates/company/supplier_part_tabs.html
index d9746b6df3..0bcd8aa4fa 100644
--- a/InvenTree/company/templates/company/supplier_part_tabs.html
+++ b/InvenTree/company/templates/company/supplier_part_tabs.html
@@ -8,12 +8,9 @@
{% trans "Pricing" %}
- {% trans "Stock" %}
+ {% trans "Stock" %}
- {% trans "Orders" %}
-
-
- {% trans "Notes" %}
+ {% trans "Orders" %}
\ No newline at end of file
diff --git a/InvenTree/company/urls.py b/InvenTree/company/urls.py
index f4251f4ceb..66cc0b9cd8 100644
--- a/InvenTree/company/urls.py
+++ b/InvenTree/company/urls.py
@@ -50,6 +50,8 @@ supplier_part_detail_urls = [
url(r'^edit/?', views.SupplierPartEdit.as_view(), name='supplier-part-edit'),
url(r'^pricing/', views.SupplierPartDetail.as_view(template_name='company/supplier_part_pricing.html'), name='supplier-part-pricing'),
+ url(r'^orders/', views.SupplierPartDetail.as_view(template_name='company/supplier_part_orders.html'), name='supplier-part-orders'),
+ url(r'^stock/', views.SupplierPartDetail.as_view(template_name='company/supplier_part_stock.html'), name='supplier-part-stock'),
url('^.*$', views.SupplierPartDetail.as_view(), name='supplier-part-detail'),
]
diff --git a/InvenTree/stock/api.py b/InvenTree/stock/api.py
index b691041bde..af2d724f58 100644
--- a/InvenTree/stock/api.py
+++ b/InvenTree/stock/api.py
@@ -301,6 +301,7 @@ class StockList(generics.ListCreateAPIView):
'part__category',
'part__category__name',
'part__category__description',
+ 'supplier_part',
)
# Reduce the number of lookups we need to do for categories
@@ -371,7 +372,13 @@ class StockList(generics.ListCreateAPIView):
except PartCategory.DoesNotExist:
pass
- # Filter by supplier
+ # Filter by supplier_part ID
+ supplier_part_id = self.request.query_params.get('supplier_part', None)
+
+ if supplier_part_id:
+ stock_list = stock_list.filter(supplier_part=supplier_part_id)
+
+ # Filter by supplier ID
supplier_id = self.request.query_params.get('supplier', None)
if supplier_id: