diff --git a/backend/core/helpers.py b/backend/core/helpers.py index 9653d254c..2584b4e29 100644 --- a/backend/core/helpers.py +++ b/backend/core/helpers.py @@ -1250,7 +1250,7 @@ def duplicate_and_link_object(new_obj, duplicate_object, target_folder, field_na # Get parent and sub-folders of the target folder target_parent_folders = target_folder.get_parent_folders() - sub_folders = target_folder.sub_folders() + sub_folders = target_folder.get_sub_folders() # Get all related objects for the specified field related_objects = getattr(source_object, field_name).all() diff --git a/backend/core/views.py b/backend/core/views.py index 47d1c90ee..25d0befc3 100644 --- a/backend/core/views.py +++ b/backend/core/views.py @@ -650,8 +650,9 @@ def duplicate(self, request, pk): if ( duplicate_risk_assessment.project.folder - in [risk_assessment.project.folder] - + risk_assessment.project.folder.sub_folders() + == risk_assessment.project.folder + or duplicate_risk_assessment.project.folder + in risk_assessment.project.folder.get_sub_folders() ): duplicate_scenario.owner.set(scenario.owner.all())