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:
@@ -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)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user