mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #2725 from SchrodingersGat/duplicate-stock-item-success
Fixes for "duplicate stock item" form
This commit is contained in:
commit
7f888923c8
@ -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() {
|
||||
|
@ -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) {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user