2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-08-07 04:12:11 +00:00

Include custom state values in specific API endpoints

This commit is contained in:
Oliver Walters
2024-11-24 05:00:45 +00:00
parent ec55c57609
commit 063b5f154a

View File

@@ -72,6 +72,21 @@ class StatusView(GenericAPIView):
data = {'class': status_class.__name__, 'values': status_class.dict()}
# Extend with custom values
try:
custom_values = status_class.custom_values()
for item in custom_values:
if item.name not in data['values']:
data['values'][item.name] = {
'color': item.color,
'logical_key': item.logical_key,
'key': item.key,
'label': item.label,
'name': item.name,
}
except Exception:
pass
return Response(data)