mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add a button if a stock item test report is available
This commit is contained in:
parent
1ad7e699a9
commit
71681bfda1
@ -372,6 +372,11 @@ class Part(MPTTModel):
|
|||||||
|
|
||||||
return templates
|
return templates
|
||||||
|
|
||||||
|
def has_test_report_templates(self):
|
||||||
|
""" Return True if this part has a TestReport defined """
|
||||||
|
|
||||||
|
return len(self.get_test_report_templates()) > 0
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
""" Return the web URL for viewing this part """
|
""" Return the web URL for viewing this part """
|
||||||
return reverse('part-detail', kwargs={'pk': self.id})
|
return reverse('part-detail', kwargs={'pk': self.id})
|
||||||
|
@ -212,6 +212,7 @@ class TestReport(ReportTemplateBase, PartFilterMixin):
|
|||||||
def getSubdir(self):
|
def getSubdir(self):
|
||||||
return 'test'
|
return 'test'
|
||||||
|
|
||||||
|
# Requires a stock_item object to be given to it before rendering
|
||||||
stock_item = None
|
stock_item = None
|
||||||
|
|
||||||
def get_context_data(self, request):
|
def get_context_data(self, request):
|
||||||
|
@ -93,8 +93,13 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}
|
|||||||
<span class='fas fa-copy'/>
|
<span class='fas fa-copy'/>
|
||||||
</button>
|
</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if item.part.has_test_report_templates %}
|
||||||
|
<button type='button' class='btn btn-default' id='stock-test-report' title='Generate test report'>
|
||||||
|
<span class='fas fa-tasks'/>
|
||||||
|
</button>
|
||||||
|
{% endif %}
|
||||||
<button type='button' class='btn btn-default' id='stock-edit' title='Edit stock item'>
|
<button type='button' class='btn btn-default' id='stock-edit' title='Edit stock item'>
|
||||||
<span class='fas fa-edit'/>
|
<span class='fas fa-edit icon-blue'/>
|
||||||
</button>
|
</button>
|
||||||
{% if item.can_delete %}
|
{% if item.can_delete %}
|
||||||
<button type='button' class='btn btn-default' id='stock-delete' title='Edit stock item'>
|
<button type='button' class='btn btn-default' id='stock-delete' title='Edit stock item'>
|
||||||
|
Loading…
Reference in New Issue
Block a user