From 57551d3ac317792c9ef2875e54a9ae21ad1b2eb7 Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 27 Jul 2021 08:17:53 +1000 Subject: [PATCH] inventreeDelete was not returning the promise --- InvenTree/company/templates/company/detail.html | 2 +- InvenTree/company/templates/company/manufacturer_part.html | 4 ++-- InvenTree/part/templates/part/detail.html | 4 ++-- InvenTree/templates/js/api.js | 3 +-- InvenTree/templates/js/company.js | 2 +- InvenTree/templates/js/stock.js | 4 ++-- 6 files changed, 9 insertions(+), 10 deletions(-) diff --git a/InvenTree/company/templates/company/detail.html b/InvenTree/company/templates/company/detail.html index 4a9ac43758..884ec6e8de 100644 --- a/InvenTree/company/templates/company/detail.html +++ b/InvenTree/company/templates/company/detail.html @@ -371,7 +371,7 @@ requests.push(inventreeDelete(url)); }); - $.when.apply($, requests).then(function() { + $.when.apply($, requests).done(function() { $('#supplier-part-table').bootstrapTable('refresh'); }); } diff --git a/InvenTree/company/templates/company/manufacturer_part.html b/InvenTree/company/templates/company/manufacturer_part.html index 94ff64440f..4623eb3a07 100644 --- a/InvenTree/company/templates/company/manufacturer_part.html +++ b/InvenTree/company/templates/company/manufacturer_part.html @@ -207,7 +207,7 @@ $("#supplier-part-delete").click(function() { requests.push(inventreeDelete(url)); }); - $.when.apply($, requests).then(function() { + $.when.apply($, requests).done(function() { reloadSupplierPartTable(); }); } @@ -247,7 +247,7 @@ $("#multi-parameter-delete").click(function() { requests.push(inventreeDelete(url)); }); - $.when.apply($, requests).then(function() { + $.when.apply($, requests).done(function() { $('#parameter-table').bootstrapTable('refresh'); }); } diff --git a/InvenTree/part/templates/part/detail.html b/InvenTree/part/templates/part/detail.html index b4cebe478e..00d7f01e47 100644 --- a/InvenTree/part/templates/part/detail.html +++ b/InvenTree/part/templates/part/detail.html @@ -416,7 +416,7 @@ }); // Wait for *all* the requests to complete - $.when.apply($, requests).then(function() { + $.when.apply($, requests).done(function() { location.reload(); }); } @@ -832,7 +832,7 @@ requests.push(inventreeDelete(url)); }); - $.when.apply($, requests).then(function() { + $.when.apply($, requests).done(function() { reloadSupplierPartTable(); }); } diff --git a/InvenTree/templates/js/api.js b/InvenTree/templates/js/api.js index 8169671836..4cf07638dc 100644 --- a/InvenTree/templates/js/api.js +++ b/InvenTree/templates/js/api.js @@ -147,8 +147,7 @@ function inventreeDelete(url, options={}) { options.method = 'DELETE'; - inventreePut(url, {}, options); - + return inventreePut(url, {}, options); } diff --git a/InvenTree/templates/js/company.js b/InvenTree/templates/js/company.js index b202fbcd52..f671fb616f 100644 --- a/InvenTree/templates/js/company.js +++ b/InvenTree/templates/js/company.js @@ -349,7 +349,7 @@ function deleteManufacturerParts(selections, options={}) { }); // Wait for all the requests to complete - $.when.apply($, requests).then(function() { + $.when.apply($, requests).done(function() { if (options.onSuccess) { options.onSuccess(); diff --git a/InvenTree/templates/js/stock.js b/InvenTree/templates/js/stock.js index 947e7fb3e9..a2015797fe 100644 --- a/InvenTree/templates/js/stock.js +++ b/InvenTree/templates/js/stock.js @@ -287,7 +287,7 @@ function adjustStock(action, items, options={}) { }); // Wait for *all* the requests to complete - $.when.apply($, requests).then(function() { + $.when.apply($, requests).done(function() { // Destroy the modal window $(modal).modal('hide'); @@ -1265,7 +1265,7 @@ function loadStockTable(table, options) { ); }); - $.when.apply($, requests).then(function() { + $.when.apply($, requests).done(function() { $("#stock-table").bootstrapTable('refresh'); }); })