mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #1842 from SchrodingersGat/installed-items
Add "installed_items" as a context variable to TestReport
This commit is contained in:
commit
ca36775f62
@ -357,7 +357,8 @@ class TestReport(ReportTemplateBase):
|
||||
'serial': stock_item.serial,
|
||||
'part': stock_item.part,
|
||||
'results': stock_item.testResultMap(include_installed=self.include_installed),
|
||||
'result_list': stock_item.testResultList(include_installed=self.include_installed)
|
||||
'result_list': stock_item.testResultList(include_installed=self.include_installed),
|
||||
'installed_items': stock_item.get_installed_items(cascade=True),
|
||||
}
|
||||
|
||||
|
||||
|
@ -56,6 +56,10 @@ content: "{% trans 'Stock Item Test Report' %}";
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block pre_page_content %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block page_content %}
|
||||
|
||||
<div class='container'>
|
||||
@ -80,6 +84,7 @@ content: "{% trans 'Stock Item Test Report' %}";
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if resul_list|length > 0 %}
|
||||
<h3>{% trans "Test Results" %}</h3>
|
||||
|
||||
<table class='table test-table'>
|
||||
@ -112,5 +117,37 @@ content: "{% trans 'Stock Item Test Report' %}";
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
{% endif %}
|
||||
|
||||
{% if installed_items|length > 0 %}
|
||||
<h3>{% trans "Installed Items" %}</h3>
|
||||
|
||||
<table class='table test-table'>
|
||||
<thead>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for sub_item in installed_items %}
|
||||
<tr>
|
||||
<td>
|
||||
<img src='{% part_image sub_item.part %}' class='part-img' style='max-width: 24px; max-height: 24px;'>
|
||||
{{ sub_item.part.full_name }}
|
||||
</td>
|
||||
<td>
|
||||
{% if sub_item.serialized %}
|
||||
{% trans "Serial" %}: {{ sub_item.serial }}
|
||||
{% else %}
|
||||
{% trans "Quantity" %}: {% decimal sub_item.quantity %}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block post_page_content %}
|
||||
|
||||
{% endblock %}
|
Loading…
Reference in New Issue
Block a user