From 1f01229d30f59bb29546357ac15dfac11a72ca14 Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Tue, 31 Mar 2026 23:54:44 +0200 Subject: [PATCH] fix(backend): API description ordering more deterministic (#11649) * fix(backend): API description ordering more deterministic * bump API * Update API version history in api_version.py --- src/backend/InvenTree/InvenTree/api_version.py | 5 ++++- src/backend/InvenTree/InvenTree/helpers_model.py | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/backend/InvenTree/InvenTree/api_version.py b/src/backend/InvenTree/InvenTree/api_version.py index f6c543b0e3..2c6773ae7e 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 = 467 +INVENTREE_API_VERSION = 468 """Increment this API version number whenever there is a significant change to the API that any clients need to know about.""" INVENTREE_API_TEXT = """ +v468 -> 2026-03-31 : https://github.com/inventree/InvenTree/pull/11649 + - Add ordering to contetype related fields - no functional changes + v467 -> 2026-03-20 : https://github.com/inventree/InvenTree/pull/11573 - Fix definition for the "parent" field on the StockItemSerializer diff --git a/src/backend/InvenTree/InvenTree/helpers_model.py b/src/backend/InvenTree/InvenTree/helpers_model.py index 5fa5ae3cea..a16b0132f6 100644 --- a/src/backend/InvenTree/InvenTree/helpers_model.py +++ b/src/backend/InvenTree/InvenTree/helpers_model.py @@ -288,6 +288,8 @@ def getModelsWithMixin(mixin_class) -> list: models_with_mixin = [ x for x in db_models if x is not None and issubclass(x, mixin_class) ] + # sort to make resulting list deterministic (and easier to test) + models_with_mixin.sort(key=lambda x: x._meta.label_lower) # Store the result in the session cache set_session_cache(cache_key, models_with_mixin)