From c5253560e892d24833fa26fde0b212e3ab7b5d82 Mon Sep 17 00:00:00 2001 From: Oliver Date: Thu, 29 Oct 2026 10:41:09 +1100 Subject: [PATCH] [UI] Add "on_order" column to SupplierPartTable (#13128) * [UI] Add "on_order" column to SupplierPartTable * Add 'on_order' filter for SupplierPart * Update table * Fix PR ref --- src/backend/InvenTree/InvenTree/api_version.py | 5 ++++- src/backend/InvenTree/company/api.py | 10 ++++++++++ .../src/tables/purchasing/SupplierPartTable.tsx | 15 ++++++++++++++- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/backend/InvenTree/InvenTree/api_version.py b/src/backend/InvenTree/InvenTree/api_version.py index d2a6740b80..5bc2857db1 100644 --- a/src/backend/InvenTree/InvenTree/api_version.py +++ b/src/backend/InvenTree/InvenTree/api_version.py @@ -1,11 +1,14 @@ """InvenTree API version information.""" # InvenTree API version -INVENTREE_API_VERSION = 566 +INVENTREE_API_VERSION = 567 """Increment this API version number whenever there is a significant change to the API that any clients need to know about.""" INVENTREE_API_TEXT = """ +v567 -> 2026-10-28 : https://github.com/inventree/InvenTree/pull/13128 + - Allow ordering of SupplierPart API by "on_order" field + v566 -> 2026-10-25 : https://github.com/inventree/InvenTree/pull/13101 - Audit log API (/api/audit/) is available to all authenticated users (entries are filtered by model permissions) - Adds "event_type", "event_label", "notes" and "deltas" fields to the audit log API diff --git a/src/backend/InvenTree/company/api.py b/src/backend/InvenTree/company/api.py index c942aabb9d..5c83069342 100644 --- a/src/backend/InvenTree/company/api.py +++ b/src/backend/InvenTree/company/api.py @@ -327,6 +327,15 @@ class SupplierPartFilter(FilterSet): else: return queryset.exclude(in_stock__gt=0) + on_order = rest_filters.BooleanFilter(label=_('On Order'), method='filter_on_order') + + def filter_on_order(self, queryset, name, value): + """Filter the queryset based on whether the SupplierPart has stock on order.""" + if value: + return queryset.filter(on_order__gt=0) + else: + return queryset.exclude(on_order__gt=0) + tag_name = common.filters.TagsFilter() @@ -407,6 +416,7 @@ class SupplierPartList( 'packaging', 'pack_quantity', 'in_stock', + 'on_order', 'updated', ] diff --git a/src/frontend/src/tables/purchasing/SupplierPartTable.tsx b/src/frontend/src/tables/purchasing/SupplierPartTable.tsx index 6e7c7d530f..ee6c57d093 100644 --- a/src/frontend/src/tables/purchasing/SupplierPartTable.tsx +++ b/src/frontend/src/tables/purchasing/SupplierPartTable.tsx @@ -143,7 +143,15 @@ export function SupplierPartTable({ }), DecimalColumn({ accessor: 'in_stock', - sortable: true + sortable: true, + filter: ['has_stock'] + }), + DecimalColumn({ + accessor: 'on_order', + title: t`On Order`, + sortable: true, + defaultVisible: false, + filter: ['on_order'] }), { accessor: 'packaging', @@ -273,6 +281,11 @@ export function SupplierPartTable({ name: 'has_stock', label: t`In Stock`, description: t`Show supplier parts with stock` + }, + { + name: 'on_order', + label: t`On Order`, + description: t`Show supplier parts on order` } ]; }, []);