mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 20:16:44 +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 %}
|
{% if roles.stock.change %}
|
||||||
$("#stock-duplicate").click(function() {
|
$("#stock-duplicate").click(function() {
|
||||||
// Duplicate a stock item
|
// Duplicate a stock item
|
||||||
duplicateStockItem({{ item.pk }}, {
|
duplicateStockItem({{ item.pk }}, {});
|
||||||
follow: true,
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#stock-edit').click(function() {
|
$('#stock-edit').click(function() {
|
||||||
|
@ -294,7 +294,17 @@ function stockItemGroups(options={}) {
|
|||||||
*/
|
*/
|
||||||
function duplicateStockItem(pk, 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}/`, {}, {
|
inventreeGet(`/api/stock/${pk}/`, {}, {
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user