2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-10-23 09:27:39 +00:00

[UI] Improve for change stock status (#10652)

- Pre-fill value if only one status set
This commit is contained in:
Oliver
2025-10-22 17:16:56 +11:00
committed by GitHub
parent 6dfedead7c
commit 754b2f2d66

View File

@@ -977,6 +977,11 @@ function stockChangeStatusFields(items: any[]): ApiFormFieldSet {
const records = Object.fromEntries(items.map((item) => [item.pk, item]));
// Extract all status values from the items
const statusValues = [
...new Set(items.map((item) => item.status_custom_key ?? item.status))
];
const fields: ApiFormFieldSet = {
items: {
field_type: 'table',
@@ -1001,7 +1006,9 @@ function stockChangeStatusFields(items: any[]): ApiFormFieldSet {
{ title: '', style: { width: '50px' } }
]
},
status: {},
status: {
value: statusValues.length === 1 ? statusValues[0] : undefined
},
note: {}
};