mirror of
https://github.com/inventree/InvenTree.git
synced 2025-12-15 08:48:11 +00:00
where one or more test report templates exist for a part,
provide a button for all stock-items of that part, allowing the user to generate and download a test repotr
This commit is contained in:
@@ -142,6 +142,35 @@ class SerializeStockForm(HelperForm):
|
||||
]
|
||||
|
||||
|
||||
class TestReportFormatForm(HelperForm):
|
||||
""" Form for selection a test report template """
|
||||
|
||||
class Meta:
|
||||
model = StockItem
|
||||
fields = [
|
||||
'template',
|
||||
]
|
||||
|
||||
|
||||
def __init__(self, stock_item, *args, **kwargs):
|
||||
self.stock_item = stock_item
|
||||
|
||||
super().__init__(*args, **kwargs)
|
||||
self.fields['template'].choices = self.get_template_choices()
|
||||
|
||||
def get_template_choices(self):
|
||||
""" Available choices """
|
||||
|
||||
choices = []
|
||||
|
||||
for report in self.stock_item.part.get_test_report_templates():
|
||||
choices.append((report.pk, report))
|
||||
|
||||
return choices
|
||||
|
||||
template = forms.ChoiceField(label=_('Template'), help_text=_('Select test report template'))
|
||||
|
||||
|
||||
class ExportOptionsForm(HelperForm):
|
||||
""" Form for selecting stock export options """
|
||||
|
||||
|
||||
Reference in New Issue
Block a user