Add option for TestReport to include tests for installed items

This commit is contained in:
Oliver Walters 2021-02-19 15:50:25 +11:00
parent a9f255be85
commit beeb94785d
2 changed files with 26 additions and 2 deletions

View File

@ -0,0 +1,18 @@
# Generated by Django 3.0.7 on 2021-02-19 04:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('report', '0012_buildreport'),
]
operations = [
migrations.AddField(
model_name='testreport',
name='include_installed',
field=models.BooleanField(default=False, help_text='Include test results for stock items installed inside assembled item', verbose_name='Include Installed Tests'),
),
]

View File

@ -281,6 +281,12 @@ class TestReport(ReportTemplateBase):
]
)
include_installed = models.BooleanField(
default=False,
verbose_name=_('Include Installed Tests'),
help_text=_('Include test results for stock items installed inside assembled item')
)
def matches_stock_item(self, item):
"""
Test if this report template matches a given StockItem objects
@ -304,8 +310,8 @@ class TestReport(ReportTemplateBase):
return {
'stock_item': stock_item,
'part': stock_item.part,
'results': stock_item.testResultMap(),
'result_list': stock_item.testResultList()
'results': stock_item.testResultMap(include_installed=self.include_installed),
'result_list': stock_item.testResultList(include_installed=self.include_installed)
}