mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Switched to get_ancestors to transverse all parents categories (not only root)
This commit is contained in:
parent
5a5a36083e
commit
279d5a00ce
@ -714,9 +714,10 @@ class PartCreate(AjaxCreateView):
|
|||||||
# Create part parameters for parent category
|
# Create part parameters for parent category
|
||||||
category_templates = form.cleaned_data['parent_category_templates']
|
category_templates = form.cleaned_data['parent_category_templates']
|
||||||
if category_templates:
|
if category_templates:
|
||||||
# Get parent category
|
# Get parent categories
|
||||||
category = form.cleaned_data['category'].get_root()
|
parent_categories = form.cleaned_data['category'].get_ancestors()
|
||||||
|
|
||||||
|
for category in parent_categories:
|
||||||
for template in category.get_parameter_templates():
|
for template in category.get_parameter_templates():
|
||||||
# Check that template wasn't already added
|
# Check that template wasn't already added
|
||||||
if template.parameter_template not in template_list:
|
if template.parameter_template not in template_list:
|
||||||
|
Loading…
Reference in New Issue
Block a user