mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Display testing status for a stock item
This commit is contained in:
parent
02b0c0831d
commit
1cc0977816
@ -301,7 +301,6 @@ class MakePartVariant(AjaxCreateView):
|
|||||||
form = super(AjaxCreateView, self).get_form()
|
form = super(AjaxCreateView, self).get_form()
|
||||||
|
|
||||||
# Hide some variant-related fields
|
# Hide some variant-related fields
|
||||||
form.fields['is_template'].widget = HiddenInput()
|
|
||||||
form.fields['variant_of'].widget = HiddenInput()
|
form.fields['variant_of'].widget = HiddenInput()
|
||||||
|
|
||||||
return form
|
return form
|
||||||
|
@ -1000,6 +1000,9 @@ class StockItem(MPTTModel):
|
|||||||
'failed': failed,
|
'failed': failed,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def hasRequiredTests(self):
|
||||||
|
return self.part.getRequiredTests().count() > 0
|
||||||
|
|
||||||
def passedAllRequiredTests(self):
|
def passedAllRequiredTests(self):
|
||||||
|
|
||||||
status = self.requiredTestStatus()
|
status = self.requiredTestStatus()
|
||||||
|
@ -15,6 +15,12 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}
|
|||||||
{% block pre_content %}
|
{% block pre_content %}
|
||||||
{% include 'stock/loc_link.html' with location=item.location %}
|
{% include 'stock/loc_link.html' with location=item.location %}
|
||||||
|
|
||||||
|
{% if item.hasRequiredTests and not item.passedAllRequiredTests %}
|
||||||
|
<div class='alert alert-block alert-danger'>
|
||||||
|
{% trans "This stock item has not passed all required tests" %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% for allocation in item.sales_order_allocations.all %}
|
{% for allocation in item.sales_order_allocations.all %}
|
||||||
<div class='alert alert-block alert-info'>
|
<div class='alert alert-block alert-info'>
|
||||||
{% trans "This stock item is allocated to Sales Order" %} <a href="{% url 'so-detail' allocation.line.order.id %}"><b>#{{ allocation.line.order.reference }}</b></a> ({% trans "Quantity" %}: {% decimal allocation.quantity %})
|
{% trans "This stock item is allocated to Sales Order" %} <a href="{% url 'so-detail' allocation.line.order.id %}"><b>#{{ allocation.line.order.reference }}</b></a> ({% trans "Quantity" %}: {% decimal allocation.quantity %})
|
||||||
@ -221,6 +227,13 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}
|
|||||||
<td>{% trans "Status" %}</td>
|
<td>{% trans "Status" %}</td>
|
||||||
<td>{% stock_status_label item.status %}</td>
|
<td>{% stock_status_label item.status %}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
{% if item.hasRequiredTests %}
|
||||||
|
<tr>
|
||||||
|
<td><span class='fas fa-vial'></span></td>
|
||||||
|
<td>{% trans "Tests" %}</td>
|
||||||
|
<td>{{ item.requiredTestStatus.passed }} / {{ item.requiredTestStatus.total }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
</table>
|
</table>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
@ -36,7 +36,8 @@ loadStockTestResultsTable(
|
|||||||
);
|
);
|
||||||
|
|
||||||
function reloadTable() {
|
function reloadTable() {
|
||||||
$("#test-result-table").bootstrapTable("refresh");
|
location.reload();
|
||||||
|
//$("#test-result-table").bootstrapTable("refresh");
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#add-test-result").click(function() {
|
$("#add-test-result").click(function() {
|
||||||
|
@ -456,11 +456,5 @@ class TestResultTest(StockTest):
|
|||||||
test='sew cushion',
|
test='sew cushion',
|
||||||
result=True
|
result=True
|
||||||
)
|
)
|
||||||
|
|
||||||
results = item.testResultMap()
|
|
||||||
|
|
||||||
for key in results.keys():
|
|
||||||
result = results[key]
|
|
||||||
|
|
||||||
self.assertTrue(item.passedAllRequiredTests())
|
self.assertTrue(item.passedAllRequiredTests())
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ function loadStockTestResultsTable(table, options) {
|
|||||||
|
|
||||||
html += makeIconButton('fa-plus icon-green', 'button-test-add', row.test_name, '{% trans "Add test result" %}');
|
html += makeIconButton('fa-plus icon-green', 'button-test-add', row.test_name, '{% trans "Add test result" %}');
|
||||||
|
|
||||||
if (!grouped) {
|
if (!grouped && row.result != null) {
|
||||||
var pk = row.pk;
|
var pk = row.pk;
|
||||||
html += makeIconButton('fa-edit icon-blue', 'button-test-edit', pk, '{% trans "Edit test result" %}');
|
html += makeIconButton('fa-edit icon-blue', 'button-test-edit', pk, '{% trans "Edit test result" %}');
|
||||||
html += makeIconButton('fa-trash-alt icon-red', 'button-test-delete', pk, '{% trans "Delete test result" %}');
|
html += makeIconButton('fa-trash-alt icon-red', 'button-test-delete', pk, '{% trans "Delete test result" %}');
|
||||||
|
Loading…
Reference in New Issue
Block a user