2
0
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:
Oliver
2022-06-07 07:25:12 +10:00
committed by GitHub
parent ea83d4b290
commit 00b75d792e
16 changed files with 218 additions and 156 deletions

View File

@ -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);
}
}
);