mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-01 21:16:46 +00:00
Handle delete differently
This commit is contained in:
parent
2bebf2d41a
commit
74e5b2cd3f
@ -223,6 +223,32 @@ function adjustStock(items, options={}) {
|
|||||||
modal: modal,
|
modal: modal,
|
||||||
onSubmit: function(fields, opts) {
|
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
|
// Data to transmit
|
||||||
var data = {
|
var data = {
|
||||||
items: [],
|
items: [],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user