mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Fix for scanItemsIntoLocation function
- Accept list of objects rather than pk values - Conform to API requirements
This commit is contained in:
parent
2c8e274aa9
commit
7dae05acc5
@ -505,7 +505,12 @@ $("#barcode-unlink").click(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$("#barcode-scan-into-location").click(function() {
|
$("#barcode-scan-into-location").click(function() {
|
||||||
scanItemsIntoLocation([{{ item.id }}]);
|
|
||||||
|
inventreeGet('{% url "api-stock-detail" item.pk %}', {}, {
|
||||||
|
success: function(item) {
|
||||||
|
scanItemsIntoLocation([item]);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function itemAdjust(action) {
|
function itemAdjust(action) {
|
||||||
|
@ -545,7 +545,7 @@ function barcodeCheckIn(location_id) {
|
|||||||
/*
|
/*
|
||||||
* Display dialog to check a single stock item into a stock location
|
* Display dialog to check a single stock item into a stock location
|
||||||
*/
|
*/
|
||||||
function scanItemsIntoLocation(item_id_list, options={}) {
|
function scanItemsIntoLocation(item_list, options={}) {
|
||||||
|
|
||||||
var modal = options.modal || '#modal-form';
|
var modal = options.modal || '#modal-form';
|
||||||
|
|
||||||
@ -595,9 +595,10 @@ function scanItemsIntoLocation(item_id_list, options={}) {
|
|||||||
|
|
||||||
var items = [];
|
var items = [];
|
||||||
|
|
||||||
item_id_list.forEach(function(pk) {
|
item_list.forEach(function(item) {
|
||||||
items.push({
|
items.push({
|
||||||
pk: pk,
|
pk: item.pk || item.id,
|
||||||
|
quantity: item.quantity,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -617,13 +618,10 @@ function scanItemsIntoLocation(item_id_list, options={}) {
|
|||||||
// First hide the modal
|
// First hide the modal
|
||||||
$(modal).modal('hide');
|
$(modal).modal('hide');
|
||||||
|
|
||||||
if (status == 'success' && 'success' in response) {
|
if (options.success) {
|
||||||
addCachedAlert(response.success);
|
options.success(response);
|
||||||
location.reload();
|
|
||||||
} else {
|
} else {
|
||||||
showMessage('{% trans "Error transferring stock" %}', {
|
location.reload();
|
||||||
style: 'danger',
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1972,7 +1972,7 @@ function loadStockTable(table, options) {
|
|||||||
var items = [];
|
var items = [];
|
||||||
|
|
||||||
selections.forEach(function(item) {
|
selections.forEach(function(item) {
|
||||||
items.push(item.pk);
|
items.push(item);
|
||||||
});
|
});
|
||||||
|
|
||||||
scanItemsIntoLocation(items);
|
scanItemsIntoLocation(items);
|
||||||
|
Loading…
Reference in New Issue
Block a user