-
diff --git a/InvenTree/part/templates/part/supplier.html b/InvenTree/part/templates/part/supplier.html
index 38596ba03c..e20baae3e9 100644
--- a/InvenTree/part/templates/part/supplier.html
+++ b/InvenTree/part/templates/part/supplier.html
@@ -66,58 +66,18 @@
});
});
- $("#supplier-table").inventreeTable({
- formatNoMatches: function() { return "No supplier parts available for {{ part.full_name }}"; },
- queryParams: function(p) {
- return {
- part: {{ part.id }}
- }
- },
- columns: [
- {
- checkbox: true,
+ loadSupplierPartTable(
+ "#supplier-table",
+ "{% url 'api-supplier-part-list' %}",
+ {
+ params: {
+ part: {{ part.id }},
+ part_detail: true,
+ supplier_detail: true,
+ manufacturer_detail: true,
},
- {
- sortable: true,
- field: 'supplier_name',
- title: 'Supplier',
- formatter: function(value, row, index, field) {
- return imageHoverIcon(row.supplier_logo) + renderLink(value, '/company/' + row.supplier + '/');
- }
- },
- {
- sortable: true,
- field: 'SKU',
- title: 'SKU',
- formatter: function(value, row, index, field) {
- return renderLink(value, row.url);
- }
- },
- {
- sortable: true,
- field: 'manufacturer',
- title: 'Manufacturer',
- },
- {
- sortable: true,
- field: 'MPN',
- title: 'MPN',
- },
- {
- sortable: true,
- field: 'pricing',
- title: 'Price',
- formatter: function(value, row, index, field) {
- if (value) {
- return value;
- } else {
- return "
No pricing available";
- }
- },
- }
- ],
- url: "{% url 'api-part-supplier-list' %}"
- });
+ }
+ );
linkButtonsToSelection($("#supplier-table"), ['#supplier-part-options'])
diff --git a/InvenTree/part/views.py b/InvenTree/part/views.py
index 8f1311b96a..b36d097185 100644
--- a/InvenTree/part/views.py
+++ b/InvenTree/part/views.py
@@ -1268,8 +1268,6 @@ class PartExport(AjaxView):
# Filter by part category
cat_id = request.GET.get('category', None)
- print('cat_id:', cat_id)
-
part_list = None
if cat_id is not None:
diff --git a/InvenTree/stock/api.py b/InvenTree/stock/api.py
index ebc5454d5b..b9132ab557 100644
--- a/InvenTree/stock/api.py
+++ b/InvenTree/stock/api.py
@@ -8,6 +8,7 @@ from django_filters import NumberFilter
from django.conf import settings
from django.conf.urls import url, include
from django.urls import reverse
+from django.db.models import Q
from .models import StockLocation, StockItem
from .models import StockItemTracking
@@ -494,11 +495,23 @@ class StockList(generics.ListCreateAPIView):
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)
+ # Filter by company (either manufacturer or supplier)
+ company = self.request.query_params.get('company', None)
- if supplier_id:
- stock_list = stock_list.filter(supplier_part__supplier=supplier_id)
+ if company is not None:
+ stock_list = stock_list.filter(Q(supplier_part__supplier=company) | Q(supplier_part__manufacturer=company))
+
+ # Filter by supplier
+ supplier = self.request.query_params.get('supplier', None)
+
+ if supplier is not None:
+ stock_list = stock_list.filter(supplier_part__supplier=supplier)
+
+ # Filter by manufacturer
+ manufacturer = self.request.query_params.get('manufacturer', None)
+
+ if manufacturer is not None:
+ stock_list = stock_list.filter(supplier_part__manufacturer=manufacturer)
# Also ensure that we pre-fecth all the related items
stock_list = stock_list.prefetch_related(
diff --git a/InvenTree/templates/InvenTree/search.html b/InvenTree/templates/InvenTree/search.html
index 03b64419c7..e8cda96809 100644
--- a/InvenTree/templates/InvenTree/search.html
+++ b/InvenTree/templates/InvenTree/search.html
@@ -135,55 +135,23 @@ InvenTree | {% trans "Search Results" %}
}
);
- $("#company-results-table").inventreeTable({
- url: "{% url 'api-company-list' %}",
- queryParams: {
- search: "{{ query }}",
- },
- columns: [
- {
- field: 'name',
- title: 'Name',
- formatter: function(value, row, index, field) {
- return imageHoverIcon(row.image) + renderLink(value, row.url);
- },
- },
- {
- field: 'description',
- title: 'Description',
- },
- ]
+ loadCompanyTable('#company-results-table', "{% url 'api-company-list' %}", {
+ params: {
+ serach: "{{ query }}",
+ }
});
- $("#supplier-part-results-table").inventreeTable({
- url: "{% url 'api-part-supplier-list' %}",
- queryParams: {
- search: "{{ query }}",
- },
- columns: [
- {
- field: 'supplier_name',
- title: 'Supplier',
- formatter: function(value, row, index, field) {
- return imageHoverIcon(row.supplier_logo) + renderLink(value, '/company/' + row.supplier + '/');
- }
+ loadSupplierPartTable(
+ "#supplier-part-results-table",
+ "{% url 'api-supplier-part-list' %}",
+ {
+ params: {
+ search: "{{ query }}",
+ part_detail: true,
+ supplier_detail: true,
+ manufacturer_detail: true
},
- {
- field: 'SKU',
- title: 'SKU',
- formatter: function(value, row, index, field) {
- return renderLink(value, row.url);
- }
- },
- {
- field: 'manufacturer',
- title: 'Manufacturer',
- },
- {
- field: 'MPN',
- title: 'MPN',
- }
- ]
- });
+ }
+ );
{% endblock %}
\ No newline at end of file
diff --git a/InvenTree/templates/base.html b/InvenTree/templates/base.html
index 987e1872f2..3cae9fd37b 100644
--- a/InvenTree/templates/base.html
+++ b/InvenTree/templates/base.html
@@ -108,6 +108,7 @@ InvenTree
+
diff --git a/InvenTree/templates/navbar.html b/InvenTree/templates/navbar.html
index e44107e2d1..c41ef3718f 100644
--- a/InvenTree/templates/navbar.html
+++ b/InvenTree/templates/navbar.html
@@ -10,8 +10,20 @@
{% trans "Parts" %}
{% trans "Stock" %}
{% trans "Build" %}
-
{% trans "Suppliers" %}
-
{% trans "Orders" %}
+
+ {% trans "Buy" %}
+
+
+
+ {% trans "Sell" %}
+
+
{% include "search_form.html" %}