diff --git a/docs/docs/stock/index.md b/docs/docs/stock/index.md index d3c544a3c8..83ec1e5f78 100644 --- a/docs/docs/stock/index.md +++ b/docs/docs/stock/index.md @@ -24,7 +24,7 @@ Each *Stock Item* is linked to the following information: **Last Updated** - Date that the stock quantity was last updated -**Last Stocktake** - Date of most recent stocktake (count) of this item +**Last Stocktake** - Date that this stock item was last counted **Status** - Status of this stock item diff --git a/src/backend/InvenTree/machine/api.py b/src/backend/InvenTree/machine/api.py index 24342cc3f9..76d9d80be3 100644 --- a/src/backend/InvenTree/machine/api.py +++ b/src/backend/InvenTree/machine/api.py @@ -97,6 +97,10 @@ class MachineSettingList(APIView): ) all_settings.extend(list(settings_dict.values())) + # Sort settings by the 'key' field before returning, + # to ensure a deterministic order in the API response + all_settings = sorted(all_settings, key=lambda x: x.key) + results = MachineSerializers.MachineSettingSerializer( all_settings, many=True ).data diff --git a/src/backend/InvenTree/plugin/api.py b/src/backend/InvenTree/plugin/api.py index 91580062b3..b87bcdd070 100644 --- a/src/backend/InvenTree/plugin/api.py +++ b/src/backend/InvenTree/plugin/api.py @@ -380,8 +380,12 @@ class PluginAllSettingList(APIView): settings_definition=settings, plugin=plugin.plugin_config() ) + # Sort settings by the 'key' field before returning, + # to ensure a deterministic order in the API response + settings_values = sorted(settings_dict.values(), key=lambda x: x.key) + results = PluginSerializers.PluginSettingSerializer( - list(settings_dict.values()), many=True + settings_values, many=True ).data return Response(results) @@ -444,8 +448,12 @@ class PluginUserSettingList(APIView): user=request.user, ) + # Sort settings by the 'key' field before returning, + # to ensure a deterministic order in the API response + settings_values = sorted(settings_dict.values(), key=lambda x: x.key) + results = PluginSerializers.PluginUserSettingSerializer( - list(settings_dict.values()), many=True + settings_values, many=True ).data return Response(results)