mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-12 07:54:14 +00:00
Adds API mixin for "bulk delete" (#3146)
* Introduces a BulkDelete API mixin class - Allows deletion of multiple items against a single API request * Bump API version * Adds BulkDelete mixin to StockItemTestResult API class * refactor "multi BOM Item delete" to use new approach * Refactor various attachment API endpoints * Refactor multi delete for StockItem * Convert remaining enndpoints over * Fix for API test code
This commit is contained in:
@ -12,7 +12,6 @@
|
||||
handleFormErrors,
|
||||
imageHoverIcon,
|
||||
inventreeGet,
|
||||
inventreeMultiDelete,
|
||||
inventreePut,
|
||||
launchModalForm,
|
||||
linkButtonsToSelection,
|
||||
@ -1107,12 +1106,23 @@ function adjustStock(action, items, options={}) {
|
||||
// Delete action is handled differently
|
||||
if (action == 'delete') {
|
||||
|
||||
inventreeMultiDelete(
|
||||
var ids = [];
|
||||
|
||||
items.forEach(function(item) {
|
||||
ids.push(item.pk);
|
||||
});
|
||||
|
||||
showModalSpinner(opts.modal, true);
|
||||
inventreeDelete(
|
||||
'{% url "api-stock-list" %}',
|
||||
items,
|
||||
{
|
||||
modal: opts.modal,
|
||||
success: options.success,
|
||||
data: {
|
||||
items: ids,
|
||||
},
|
||||
success: function(response) {
|
||||
$(opts.modal).modal('hide');
|
||||
options.success(response);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
Reference in New Issue
Block a user