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:
@@ -977,6 +977,11 @@ function stockChangeStatusFields(items: any[]): ApiFormFieldSet {
|
|||||||
|
|
||||||
const records = Object.fromEntries(items.map((item) => [item.pk, item]));
|
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 = {
|
const fields: ApiFormFieldSet = {
|
||||||
items: {
|
items: {
|
||||||
field_type: 'table',
|
field_type: 'table',
|
||||||
@@ -1001,7 +1006,9 @@ function stockChangeStatusFields(items: any[]): ApiFormFieldSet {
|
|||||||
{ title: '', style: { width: '50px' } }
|
{ title: '', style: { width: '50px' } }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
status: {},
|
status: {
|
||||||
|
value: statusValues.length === 1 ? statusValues[0] : undefined
|
||||||
|
},
|
||||||
note: {}
|
note: {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user