From 9cb039f68584b91b77523b65fe079e100f66ac4c Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Tue, 19 May 2020 17:08:19 +1000 Subject: [PATCH 1/2] Remove a test (for now) which is causing issues... --- InvenTree/stock/models.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/InvenTree/stock/models.py b/InvenTree/stock/models.py index 9caf9f568b..8dfd25760f 100644 --- a/InvenTree/stock/models.py +++ b/InvenTree/stock/models.py @@ -1117,6 +1117,8 @@ class StockItemTestResult(models.Model): templates = self.stock_item.part.getTestTemplates() + """ + TODO: Re-introduce this at a later stage, it is buggy when uplaoding an attachment via the API for template in templates: if key == template.key: @@ -1126,16 +1128,14 @@ class StockItemTestResult(models.Model): "value": _("Value must be provided for this test"), }) - """ - TODO: Re-introduce this at a later stage, it is buggy when uplaoding an attachment via the API if template.requires_attachment: if not self.attachment: raise ValidationError({ "attachment": _("Attachment must be uploaded for this test"), }) - """ break + """ # If an attachment is linked to this result, the attachment must also point to the item try: From b121262af12e884e10f2631d56075c6c3b3787a8 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Tue, 19 May 2020 17:37:00 +1000 Subject: [PATCH 2/2] pep FIX --- InvenTree/stock/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/InvenTree/stock/models.py b/InvenTree/stock/models.py index 8dfd25760f..512a156b08 100644 --- a/InvenTree/stock/models.py +++ b/InvenTree/stock/models.py @@ -1112,12 +1112,12 @@ class StockItemTestResult(models.Model): super().clean() + """ # If this test result corresponds to a template, check the requirements of the template key = helpers.generateTestKey(self.test) templates = self.stock_item.part.getTestTemplates() - """ TODO: Re-introduce this at a later stage, it is buggy when uplaoding an attachment via the API for template in templates: if key == template.key: