2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-20 22:06:28 +00:00

Clean up implementation of test report matching

This commit is contained in:
Oliver Walters
2020-08-23 21:03:29 +10:00
parent b7ae95686e
commit c849f618d5
5 changed files with 21 additions and 27 deletions

View File

@ -399,24 +399,6 @@ class Part(MPTTModel):
self.category = category
self.save()
def get_test_report_templates(self):
"""
Return all the TestReport template objects which map to this Part.
"""
templates = []
for report in ReportModels.TestReport.objects.all():
if report.matches_part(self):
templates.append(report)
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):
""" Return the web URL for viewing this part """
return reverse('part-detail', kwargs={'pk': self.id})