From be856c36826c83f668d0b63d43737aa57936b31c Mon Sep 17 00:00:00 2001 From: Oliver Date: Mon, 1 May 2023 23:50:20 +1000 Subject: [PATCH] Scan in items fix (#4738) * Clean up comments * Bug fix - Pass options.modal through if provided when creating new barcodeDialog * Fix for scanning from item context into location --- InvenTree/templates/js/translated/barcode.js | 8 +- InvenTree/templates/js/translated/modals.js | 173 ++++++++++--------- 2 files changed, 93 insertions(+), 88 deletions(-) diff --git a/InvenTree/templates/js/translated/barcode.js b/InvenTree/templates/js/translated/barcode.js index 71b1d26376..6ab9624dbd 100644 --- a/InvenTree/templates/js/translated/barcode.js +++ b/InvenTree/templates/js/translated/barcode.js @@ -170,7 +170,7 @@ function postBarcodeData(barcode_data, options={}) { if (options.onError400) { options.onError400(xhr.responseJSON, options); } else { - console.log(xhr); + console.error(xhr); data = xhr.responseJSON || {}; showBarcodeMessage(modal, data.error || '{% trans "Server error" %}'); } @@ -279,7 +279,7 @@ function getBarcodeData(modal) { */ function barcodeDialog(title, options={}) { - var modal = createNewModal(); + var modal = options.modal || createNewModal(); options.modal = modal; @@ -571,7 +571,7 @@ function barcodeCheckInStockItems(location_id, options={}) { }); } - var table = `
`; + var table = `
`; // Extra form fields var extra = makeNotesField(); @@ -589,6 +589,7 @@ function barcodeCheckInStockItems(location_id, options={}) { onShow: function() { }, extraFields: extra, + modal: modal, onSubmit: function() { // Called when the 'check-in' button is pressed @@ -776,6 +777,7 @@ function scanItemsIntoLocation(item_list, options={}) { { headerContent: header, extraFields: extra, + modal: modal, preShow: function() { modalSetSubmitText(modal, '{% trans "Check In" %}'); modalEnable(modal, false); diff --git a/InvenTree/templates/js/translated/modals.js b/InvenTree/templates/js/translated/modals.js index 01eb244a96..0880b55e1a 100644 --- a/InvenTree/templates/js/translated/modals.js +++ b/InvenTree/templates/js/translated/modals.js @@ -187,19 +187,19 @@ function makeOption(text, value, title) { return html; } +/* + * Programatically generate a list of