diff --git a/InvenTree/part/templates/part/detail.html b/InvenTree/part/templates/part/detail.html index 919511a25e..c43aec77eb 100644 --- a/InvenTree/part/templates/part/detail.html +++ b/InvenTree/part/templates/part/detail.html @@ -15,6 +15,7 @@
@@ -98,6 +99,11 @@ {% endblock %} +{% block js_load %} +{{ block.super }} + + +{% endblock %} {% block js_ready %} {{ block.super }} @@ -116,4 +122,17 @@ redirect: {% if part.category %}"{% url 'category-detail' part.category.id %}"{% else %}"{% url 'part-index' %}"{% endif %} }); }); + + $('#stocktake-part').click(function() { + adjustStock({ + action: 'stocktake', + query: { + part: {{ part.id }}, + }, + success: function() { + location.reload(); + } + }); + }); + {% endblock %} diff --git a/InvenTree/static/script/inventree/stock.js b/InvenTree/static/script/inventree/stock.js index cfcb8a84da..8fd187c3b5 100644 --- a/InvenTree/static/script/inventree/stock.js +++ b/InvenTree/static/script/inventree/stock.js @@ -82,7 +82,7 @@ function updateStock(items, options={}) { html += "Note field must be filled
"; + html += "Note field must be filled
"; var title = ''; @@ -102,9 +102,17 @@ function updateStock(items, options={}) { content: html }); + $(modal).find('#note-warning').hide(); + modalSubmit(modal, function() { var stocktake = []; + var notes = $(modal).find('#stocktake-notes').val(); + + if (!notes) { + $(modal).find('#note-warning').show(); + return false; + } var valid = true;