2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-19 05:25:42 +00:00

Automagically disable 'serial_numbers' field for StockItemCreate form

- Yay, ajax magic!
This commit is contained in:
Oliver Walters
2020-10-20 22:37:55 +11:00
parent 2e4613e702
commit 652c2dbcbe
3 changed files with 18 additions and 6 deletions

View File

@ -769,6 +769,7 @@ function createNewStockItem(options) {
field: 'part',
action: function(value) {
// Reload options for supplier part
reloadFieldOptions(
'supplier_part',
{
@ -782,6 +783,18 @@ function createNewStockItem(options) {
}
}
);
// Disable serial number field if the part is not trackable
inventreeGet(
`/api/part/${value}/`, {},
{
success: function(response) {
enableField('serial_numbers', response.trackable);
clearField('serial_numbers');
}
}
);
}
},
];