diff --git a/InvenTree/stock/api.py b/InvenTree/stock/api.py index 023b0c6c4e..7284f8d5cd 100644 --- a/InvenTree/stock/api.py +++ b/InvenTree/stock/api.py @@ -477,6 +477,17 @@ class StockList(generics.ListCreateAPIView): if customer: queryset = queryset.filter(customer=customer) + # Filter if items have been sent to a customer (any customer) + sent_to_customer = params.get('sent_to_customer', None) + + if sent_to_customer is not None: + sent_to_customer = str2bool(sent_to_customer) + + if sent_to_customer: + queryset = queryset.exclude(customer=None) + else: + queryset = queryset.filter(customer=None) + # Filter by "serialized" status? serialized = params.get('serialized', None) @@ -507,6 +518,7 @@ class StockList(generics.ListCreateAPIView): if serial_number_lte is not None: queryset = queryset.filter(serial__lte=serial_number_lte) + # Filter by "in_stock" status in_stock = params.get('in_stock', None) if in_stock is not None: diff --git a/InvenTree/templates/js/stock.html b/InvenTree/templates/js/stock.html index f06615f2f5..11cf6a94e3 100644 --- a/InvenTree/templates/js/stock.html +++ b/InvenTree/templates/js/stock.html @@ -1,4 +1,5 @@ {% load i18n %} +{% load status_codes %} /* Stock API functions * Requires api.js to be loaded first @@ -460,12 +461,26 @@ function loadStockTable(table, options) { var html = renderLink(val, `/stock/item/${row.pk}/`); if (row.allocated) { - html += ``; + html += ``; } + if (row.customer) { + html += ``; + } else if (row.build_order) { + html += ``; + } else if (row.sales_order) { + html += ``; + } + + // Special stock status codes + + // 65 = "REJECTED" + if (row.status == 65) { + html += ``; + } // 70 = "LOST" - if (row.status == 70) { - html += ``; + else if (row.status == 70) { + html += ``; } if (row.quantity <= 0) { diff --git a/InvenTree/templates/js/table_filters.html b/InvenTree/templates/js/table_filters.html index aef430bf36..9050edba6f 100644 --- a/InvenTree/templates/js/table_filters.html +++ b/InvenTree/templates/js/table_filters.html @@ -57,6 +57,11 @@ function getAvailableTableFilters(tableKey) { title: '{% trans "In Stock" %}', description: '{% trans "Show items which are in stock" %}', }, + sent_to_customer: { + type: 'bool', + title: '{% trans "Sent to customer" %}', + description: '{% trans "Show items which have been assigned to a customer" %}', + }, serialized: { type: 'bool', title: '{% trans "Is Serialized" %}',