From d4ac35b9aa1521b20c411da1f004712cd8ad037c Mon Sep 17 00:00:00 2001 From: eeintech Date: Thu, 12 Nov 2020 16:52:22 -0500 Subject: [PATCH] Check that category was selected before fetching templates --- InvenTree/part/forms.py | 2 +- InvenTree/part/models.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/InvenTree/part/forms.py b/InvenTree/part/forms.py index 5f6a34ce51..e8847fef93 100644 --- a/InvenTree/part/forms.py +++ b/InvenTree/part/forms.py @@ -215,6 +215,7 @@ class EditPartForm(HelperForm): class Meta: model = Part fields = [ + 'confirm_creation', 'category', 'selected_category_templates', 'parent_category_templates', @@ -224,7 +225,6 @@ class EditPartForm(HelperForm): 'revision', 'bom_copy', 'parameters_copy', - 'confirm_creation', 'keywords', 'variant_of', 'link', diff --git a/InvenTree/part/models.py b/InvenTree/part/models.py index 8501fc82b3..4730ba1e9c 100644 --- a/InvenTree/part/models.py +++ b/InvenTree/part/models.py @@ -350,7 +350,7 @@ class Part(MPTTModel): # Get part category category = self.category - if add_category_templates: + if category and add_category_templates: # Store templates added to part template_list = []