diff --git a/InvenTree/templates/js/forms.js b/InvenTree/templates/js/forms.js index 490b67944f..65c1a11b44 100644 --- a/InvenTree/templates/js/forms.js +++ b/InvenTree/templates/js/forms.js @@ -715,6 +715,10 @@ function getFormFieldValue(name, field, options) { // Find the HTML element var el = $(options.modal).find(`#id_${name}`); + if (!el) { + return null; + } + var value = null; switch (field.type) { diff --git a/InvenTree/templates/js/stock.js b/InvenTree/templates/js/stock.js index 50bc49947f..8612e2758a 100644 --- a/InvenTree/templates/js/stock.js +++ b/InvenTree/templates/js/stock.js @@ -28,6 +28,9 @@ function adjustStock(items, options={}) { var formTitle = 'Form Title Here'; var actionTitle = null; + // API url + var url = null; + var specifyLocation = false; var allowSerializedStock = false; @@ -37,18 +40,22 @@ function adjustStock(items, options={}) { actionTitle = '{% trans "Move" %}'; specifyLocation = true; allowSerializedStock = true; + url = '{% url "api-stock-transfer" %}'; break; case 'count': formTitle = '{% trans "Count Stock" %}'; actionTitle = '{% trans "Count" %}'; + url = '{% url "api-stock-count" %}'; break; case 'take': formTitle = '{% trans "Remove Stock" %}'; actionTitle = '{% trans "Take" %}'; + url = '{% url "api-stock-remove" %}'; break; case 'add': formTitle = '{% trans "Add Stock" %}'; actionTitle = '{% trans "Add" %}'; + url = '{% url "api-stock-add" %}'; break; case 'delete': formTitle = '{% trans "Delete Stock" %}'; @@ -156,7 +163,7 @@ function adjustStock(items, options={}) { buttons += ``; html += ` -