From 7c753e13eb8377b0c2ffaa3dae9a5aadd8f48855 Mon Sep 17 00:00:00 2001 From: Mohamed-Hacene Date: Fri, 6 Dec 2024 11:09:54 +0100 Subject: [PATCH] fix: duplicate scenario ref_id --- backend/core/views.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/backend/core/views.py b/backend/core/views.py index d7c825dd7..9aeefd33c 100644 --- a/backend/core/views.py +++ b/backend/core/views.py @@ -850,20 +850,21 @@ def duplicate(self, request, pk): residual_impact=scenario.residual_impact, strength_of_knowledge=scenario.strength_of_knowledge, justification=scenario.justification, + ref_id=scenario.ref_id, ) for field in ["applied_controls", "threats", "assets"]: duplicate_related_objects( scenario, duplicate_scenario, - duplicate_risk_assessment.project.folder, + duplicate_risk_assessment.folder, field, ) if ( - duplicate_risk_assessment.project.folder - in [risk_assessment.project.folder] - + risk_assessment.project.folder.sub_folders() + duplicate_risk_assessment.folder + in [risk_assessment.folder] + + [risk for risk in risk_assessment.folder.get_sub_folders()] ): duplicate_scenario.owner.set(scenario.owner.all())