Tweaks for barcode scanning functionality

- Prevent javascript errors

(cherry picked from commit 9129a42a3e2a5c5939e6002d3b4010b3fd9cc20e)
This commit is contained in:
Oliver 2022-04-04 14:23:57 +10:00
parent d1a8b7ed48
commit 2c8e274aa9

View File

@ -366,7 +366,6 @@ function barcodeCheckIn(location_id) {
// List of items we are going to checkin // List of items we are going to checkin
var items = []; var items = [];
function reloadTable() { function reloadTable() {
modalEnable(modal, false); modalEnable(modal, false);
@ -389,10 +388,17 @@ function barcodeCheckIn(location_id) {
<tbody>`; <tbody>`;
items.forEach(function(item) { items.forEach(function(item) {
var location_info = `${item.location}`;
if (item.location_detail) {
location_info = `${item.location_detail.name}`;
}
html += ` html += `
<tr pk='${item.pk}'> <tr pk='${item.pk}'>
<td>${imageHoverIcon(item.part_detail.thumbnail)} ${item.part_detail.name}</td> <td>${imageHoverIcon(item.part_detail.thumbnail)} ${item.part_detail.name}</td>
<td>${item.location_detail.name}</td> <td>${location_info}</td>
<td>${item.quantity}</td> <td>${item.quantity}</td>
<td>${makeIconButton('fa-times-circle icon-red', 'button-item-remove', item.pk, '{% trans "Remove stock item" %}')}</td> <td>${makeIconButton('fa-times-circle icon-red', 'button-item-remove', item.pk, '{% trans "Remove stock item" %}')}</td>
</tr>`; </tr>`;
@ -469,6 +475,12 @@ function barcodeCheckIn(location_id) {
data.items = entries; data.items = entries;
// Prevent submission without any entries
if (entries.length == 0) {
showBarcodeMessage(modal, '{% trans "No barcode provided" %}', 'warning');
return;
}
inventreePut( inventreePut(
'{% url "api-stock-transfer" %}', '{% url "api-stock-transfer" %}',
data, data,