mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-02 05:26:45 +00:00
Add option for TestReport to include tests for installed items
This commit is contained in:
parent
a9f255be85
commit
beeb94785d
@ -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'),
|
||||||
|
),
|
||||||
|
]
|
@ -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):
|
def matches_stock_item(self, item):
|
||||||
"""
|
"""
|
||||||
Test if this report template matches a given StockItem objects
|
Test if this report template matches a given StockItem objects
|
||||||
@ -304,8 +310,8 @@ class TestReport(ReportTemplateBase):
|
|||||||
return {
|
return {
|
||||||
'stock_item': stock_item,
|
'stock_item': stock_item,
|
||||||
'part': stock_item.part,
|
'part': stock_item.part,
|
||||||
'results': stock_item.testResultMap(),
|
'results': stock_item.testResultMap(include_installed=self.include_installed),
|
||||||
'result_list': stock_item.testResultList()
|
'result_list': stock_item.testResultList(include_installed=self.include_installed)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user