From e025180242d7fbdc328e934a520e8ed81510f9c5 Mon Sep 17 00:00:00 2001 From: Oliver Date: Wed, 21 Jan 2026 17:01:24 +1100 Subject: [PATCH] Sort by ipn (#11177) * Enable sorting by IPN in BOM table * Ordering by IPN in build line table * Bump API version --- src/backend/InvenTree/InvenTree/api_version.py | 6 +++++- src/backend/InvenTree/build/api.py | 2 ++ src/backend/InvenTree/part/api.py | 2 ++ src/frontend/src/tables/bom/BomTable.tsx | 3 ++- src/frontend/src/tables/build/BuildLineTable.tsx | 3 ++- 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/backend/InvenTree/InvenTree/api_version.py b/src/backend/InvenTree/InvenTree/api_version.py index 4f6e538ceb..e5375e2501 100644 --- a/src/backend/InvenTree/InvenTree/api_version.py +++ b/src/backend/InvenTree/InvenTree/api_version.py @@ -1,11 +1,15 @@ """InvenTree API version information.""" # InvenTree API version -INVENTREE_API_VERSION = 442 +INVENTREE_API_VERSION = 443 """Increment this API version number whenever there is a significant change to the API that any clients need to know about.""" INVENTREE_API_TEXT = """ +v443 -> 2026-01-21 : https://github.com/inventree/InvenTree/pull/11177 + - Adds IPN ordering option for BomItem API endpoint + - Adds IPN ordering option for BuildLine API endpoint + v442 -> 2026-01-17 : https://github.com/inventree/InvenTree/pull/11157 - Typo fixes, no functional changes diff --git a/src/backend/InvenTree/build/api.py b/src/backend/InvenTree/build/api.py index 755a60db76..c60e4f2f05 100644 --- a/src/backend/InvenTree/build/api.py +++ b/src/backend/InvenTree/build/api.py @@ -594,6 +594,7 @@ class BuildLineList( output_options = BuildLineOutputOptions ordering_fields = [ 'part', + 'IPN', 'allocated', 'category', 'consumed', @@ -612,6 +613,7 @@ class BuildLineList( ordering_field_aliases = { 'part': 'bom_item__sub_part__name', + 'IPN': 'bom_item__sub_part__IPN', 'reference': 'bom_item__reference', 'unit_quantity': 'bom_item__quantity', 'category': 'bom_item__sub_part__category__name', diff --git a/src/backend/InvenTree/part/api.py b/src/backend/InvenTree/part/api.py index 64e3cabefb..f8f901a98a 100644 --- a/src/backend/InvenTree/part/api.py +++ b/src/backend/InvenTree/part/api.py @@ -1405,6 +1405,7 @@ class BomList( 'attrition', 'rounding_multiple', 'sub_part', + 'IPN', 'available_stock', 'allow_variants', 'inherited', @@ -1422,6 +1423,7 @@ class BomList( ordering_field_aliases = { 'category': 'sub_part__category__name', 'sub_part': 'sub_part__name', + 'IPN': 'sub_part__IPN', 'pricing_min': 'sub_part__pricing_data__overall_min', 'pricing_max': 'sub_part__pricing_data__overall_max', 'pricing_updated': 'sub_part__pricing_data__updated', diff --git a/src/frontend/src/tables/bom/BomTable.tsx b/src/frontend/src/tables/bom/BomTable.tsx index 9cb18a2720..35cc65fb43 100644 --- a/src/frontend/src/tables/bom/BomTable.tsx +++ b/src/frontend/src/tables/bom/BomTable.tsx @@ -132,7 +132,8 @@ export function BomTable({ { accessor: 'sub_part_detail.IPN', title: t`IPN`, - sortable: true + sortable: true, + ordering: 'IPN' }, CategoryColumn({ accessor: 'category_detail', diff --git a/src/frontend/src/tables/build/BuildLineTable.tsx b/src/frontend/src/tables/build/BuildLineTable.tsx index a247b69018..d4e85508a4 100644 --- a/src/frontend/src/tables/build/BuildLineTable.tsx +++ b/src/frontend/src/tables/build/BuildLineTable.tsx @@ -333,7 +333,8 @@ export default function BuildLineTable({ }), { accessor: 'part_detail.IPN', - sortable: false, + sortable: true, + ordering: 'IPN', title: t`IPN` }, CategoryColumn({