mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Stock tracking tweaks
- Ability to stocktake for entire part - Enforce addition of notes to stockAdjust modal
This commit is contained in:
parent
8000affeee
commit
2c953c73fa
@ -15,6 +15,7 @@
|
||||
<span class="caret"></span></button>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="#" id='edit-part' title='Edit part'>Edit</a></li>
|
||||
<li><a href='#' id='stocktake-part' title='Stocktake'>Stocktake</a></li>
|
||||
<li><a href="#" id='delete-part' title='Delete part'>Delete</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -98,6 +99,11 @@
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block js_load %}
|
||||
{{ block.super }}
|
||||
<script type='text/javascript' src="{% static 'script/inventree/api.js' %}"></script>
|
||||
<script type='text/javascript' src="{% static 'script/inventree/stock.js' %}"></script>
|
||||
{% 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 %}
|
||||
|
@ -82,7 +82,7 @@ function updateStock(items, options={}) {
|
||||
|
||||
html += "<hr><input type='text' id='stocktake-notes' placeholder='Notes'/>";
|
||||
|
||||
html += "<p class='warning-msg'>Note field must be filled</p>";
|
||||
html += "<p class='warning-msg' id='note-warning'><i>Note field must be filled</i></p>";
|
||||
|
||||
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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user