mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-01 19:20:55 +00:00
Clean up implementation of test report matching
This commit is contained in:
@ -202,6 +202,17 @@ class TestReport(ReportTemplateBase, PartFilterMixin):
|
||||
# Requires a stock_item object to be given to it before rendering
|
||||
stock_item = None
|
||||
|
||||
def matches_stock_item(self, item):
|
||||
"""
|
||||
Test if this report template matches a given StockItem objects
|
||||
"""
|
||||
|
||||
filters = validateFilterString(self.part_filters)
|
||||
|
||||
items = StockItem.objects.filter(**filters)
|
||||
|
||||
return items.exists()
|
||||
|
||||
def get_context_data(self, request):
|
||||
return {
|
||||
'stock_item': self.stock_item,
|
||||
|
Reference in New Issue
Block a user