mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Handle delete differently
This commit is contained in:
parent
2bebf2d41a
commit
74e5b2cd3f
@ -223,6 +223,32 @@ function adjustStock(items, options={}) {
|
||||
modal: modal,
|
||||
onSubmit: function(fields, opts) {
|
||||
|
||||
// "Delete" action gets handled differently
|
||||
if (options.action == 'delete') {
|
||||
|
||||
var requests = [];
|
||||
|
||||
items.forEach(function(item) {
|
||||
requests.push(
|
||||
inventreeDelete(
|
||||
`/api/stock/${item.pk}/`,
|
||||
)
|
||||
)
|
||||
});
|
||||
|
||||
// Wait for *all* the requests to complete
|
||||
$.when.apply($, requests).then(function() {
|
||||
// Destroy the modal window
|
||||
$(modal).modal('hide');
|
||||
|
||||
if (options.onSuccess) {
|
||||
options.onSuccess();
|
||||
}
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Data to transmit
|
||||
var data = {
|
||||
items: [],
|
||||
|
Loading…
Reference in New Issue
Block a user