From 01481ef5c9f965a88aee0e0c400794d82f4395ab Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 23 May 2020 14:28:25 +1000 Subject: [PATCH] Add function to get the number of required tests for a part --- InvenTree/part/models.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/InvenTree/part/models.py b/InvenTree/part/models.py index 735a6de574..451c916542 100644 --- a/InvenTree/part/models.py +++ b/InvenTree/part/models.py @@ -1033,6 +1033,9 @@ class Part(MPTTModel): # Return the tests which are required by this part return self.getTestTemplates(required=True) + def requiredTestCount(self): + return self.getRequiredTests().count() + @property def attachment_count(self): """ Count the number of attachments for this part.