diff --git a/InvenTree/stock/templates/stock/item_base.html b/InvenTree/stock/templates/stock/item_base.html index f023989887..7dc06664e1 100644 --- a/InvenTree/stock/templates/stock/item_base.html +++ b/InvenTree/stock/templates/stock/item_base.html @@ -462,9 +462,7 @@ $("#print-label").click(function() { {% if roles.stock.change %} $("#stock-duplicate").click(function() { // Duplicate a stock item - duplicateStockItem({{ item.pk }}, { - follow: true, - }); + duplicateStockItem({{ item.pk }}, {}); }); $('#stock-edit').click(function() { diff --git a/InvenTree/templates/js/translated/stock.js b/InvenTree/templates/js/translated/stock.js index dcca969a28..421a784281 100644 --- a/InvenTree/templates/js/translated/stock.js +++ b/InvenTree/templates/js/translated/stock.js @@ -294,7 +294,17 @@ function stockItemGroups(options={}) { */ function duplicateStockItem(pk, options) { - // First, we need the StockItem informatino + // If no "success" function provided, add a default + if (!options.onSuccess) { + options.onSuccess = function(response) { + + showAlertOrCache('{% trans "Stock item duplicated" %}', true, {style: 'success'}); + + window.location.href = `/stock/item/${response.pk}/`; + }; + } + + // First, we need the StockItem information inventreeGet(`/api/stock/${pk}/`, {}, { success: function(data) {