From 85b906f49dc32d417fa4a731ea40b6454cf6de0c Mon Sep 17 00:00:00 2001 From: Oliver Date: Wed, 10 Nov 2021 09:48:52 +1100 Subject: [PATCH] Adds "stock" column sorting for stock table --- InvenTree/stock/api.py | 2 ++ InvenTree/templates/js/translated/stock.js | 2 ++ 2 files changed, 4 insertions(+) diff --git a/InvenTree/stock/api.py b/InvenTree/stock/api.py index e287441382..e01ad51b55 100644 --- a/InvenTree/stock/api.py +++ b/InvenTree/stock/api.py @@ -876,6 +876,7 @@ class StockList(generics.ListCreateAPIView): ordering_field_aliases = { 'SKU': 'supplier_part__SKU', + 'stock': ['quantity', 'serial'], } ordering_fields = [ @@ -887,6 +888,7 @@ class StockList(generics.ListCreateAPIView): 'stocktake_date', 'expiry_date', 'quantity', + 'stock', 'status', 'SKU', ] diff --git a/InvenTree/templates/js/translated/stock.js b/InvenTree/templates/js/translated/stock.js index ec785969cd..ba4238e6f7 100644 --- a/InvenTree/templates/js/translated/stock.js +++ b/InvenTree/templates/js/translated/stock.js @@ -1128,7 +1128,9 @@ function loadStockTable(table, options) { col = { field: 'quantity', + sortName: 'stock', title: '{% trans "Stock" %}', + sortable: true, formatter: function(value, row) { var val = parseFloat(value);