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()
|
||||
|
||||
# Hide some variant-related fields
|
||||
form.fields['is_template'].widget = HiddenInput()
|
||||
form.fields['variant_of'].widget = HiddenInput()
|
||||
|
||||
return form
|
||||
|
@ -1000,6 +1000,9 @@ class StockItem(MPTTModel):
|
||||
'failed': failed,
|
||||
}
|
||||
|
||||
def hasRequiredTests(self):
|
||||
return self.part.getRequiredTests().count() > 0
|
||||
|
||||
def passedAllRequiredTests(self):
|
||||
|
||||
status = self.requiredTestStatus()
|
||||
|
@ -15,6 +15,12 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}
|
||||
{% block pre_content %}
|
||||
{% 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 %}
|
||||
<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 %})
|
||||
@ -221,6 +227,13 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}
|
||||
<td>{% trans "Status" %}</td>
|
||||
<td>{% stock_status_label item.status %}</td>
|
||||
</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>
|
||||
{% endblock %}
|
||||
|
||||
|
@ -36,7 +36,8 @@ loadStockTestResultsTable(
|
||||
);
|
||||
|
||||
function reloadTable() {
|
||||
$("#test-result-table").bootstrapTable("refresh");
|
||||
location.reload();
|
||||
//$("#test-result-table").bootstrapTable("refresh");
|
||||
}
|
||||
|
||||
$("#add-test-result").click(function() {
|
||||
|
@ -457,10 +457,4 @@ class TestResultTest(StockTest):
|
||||
result=True
|
||||
)
|
||||
|
||||
results = item.testResultMap()
|
||||
|
||||
for key in results.keys():
|
||||
result = results[key]
|
||||
|
||||
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" %}');
|
||||
|
||||
if (!grouped) {
|
||||
if (!grouped && row.result != null) {
|
||||
var pk = row.pk;
|
||||
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" %}');
|
||||
|
Loading…
Reference in New Issue
Block a user