From 8f4929d754ca8cdcbcb87d83637c665bacd25ae4 Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Sat, 24 Aug 2024 00:28:58 +0200 Subject: [PATCH] [BUG] Order of states in schema descriptions is not stable (#7978) Fixes #7977 --- src/backend/InvenTree/InvenTree/api_version.py | 6 +++++- src/backend/InvenTree/generic/states/custom.py | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/backend/InvenTree/InvenTree/api_version.py b/src/backend/InvenTree/InvenTree/api_version.py index f1df853784..f5e9237627 100644 --- a/src/backend/InvenTree/InvenTree/api_version.py +++ b/src/backend/InvenTree/InvenTree/api_version.py @@ -1,12 +1,16 @@ """InvenTree API version information.""" # InvenTree API version -INVENTREE_API_VERSION = 248 +INVENTREE_API_VERSION = 249 """Increment this API version number whenever there is a significant change to the API that any clients need to know about.""" INVENTREE_API_TEXT = """ + +v249 - 2024-08-23 : https://github.com/inventree/InvenTree/pull/7978 + - Sort status enums + v248 - 2024-08-23 : https://github.com/inventree/InvenTree/pull/7965 - Small adjustments to labels for new custom status fields diff --git a/src/backend/InvenTree/generic/states/custom.py b/src/backend/InvenTree/generic/states/custom.py index 2539eb550e..8fc8948c28 100644 --- a/src/backend/InvenTree/generic/states/custom.py +++ b/src/backend/InvenTree/generic/states/custom.py @@ -33,7 +33,8 @@ def state_color_mappings(): def state_reference_mappings(): """Return a list of custom user state references.""" - return [(a.__name__, a.__name__) for a in get_custom_classes(include_custom=False)] + classes = get_custom_classes(include_custom=False) + return [(a.__name__, a.__name__) for a in sorted(classes, key=lambda x: x.__name__)] def get_logical_value(value, model: str):