2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-01 03:00:54 +00:00

Complete refactor of the test-result table for stock item

This commit is contained in:
Oliver Walters
2020-05-17 21:09:49 +10:00
parent b9799e1824
commit 8ace71ef56
4 changed files with 151 additions and 65 deletions

View File

@ -7,7 +7,7 @@
{% include "stock/tabs.html" with tab='tests' %}
<h4>{% trans "Test Results" %}</h4>
<h4>{% trans "Test Data" %}</h4>
<hr>
<div id='button-toolbar'>
@ -20,8 +20,8 @@
</div>
</div>
</div>
<table class='table table-striped table-condensed' data-toolbar='#button-toolbar' id='test-result-table'></table>
<table class='table table-striped table-condensed' data-toolbar='#button-toolbar' id='test-result-table'></table>
{% endblock %}
@ -30,11 +30,8 @@
loadStockTestResultsTable(
$("#test-result-table"), {
params: {
stock_item: {{ item.id }},
user_detail: true,
attachment_detail: true,
},
part: {{ item.part.id }},
stock_item: {{ item.id }},
}
);
@ -53,6 +50,21 @@ $("#add-test-result").click(function() {
);
});
$("#test-result-table").on('click', '.button-test-add', function() {
var button = $(this);
var test_name = button.attr('pk');
launchModalForm(
"{% url 'stock-item-test-create' %}", {
data: {
stock_item: {{ item.id }},
test: test_name
},
}
);
});
$("#test-result-table").on('click', '.button-test-edit', function() {
var button = $(this);

View File

@ -254,6 +254,8 @@ class StockItemTestResultCreate(AjaxCreateView):
except (ValueError, StockItem.DoesNotExist):
pass
initials['test'] = self.request.GET.get('test', '')
return initials
def get_form(self):