Defect #17068
openWhen copying subtasks with relations between them self's are lost
Added by Fernando Hartmann over 12 years ago. Updated 5 days ago.
Description
Suppose I have a task (Task1) with two subtaks, Sub1 and Sub2 and Sub1 preceeds sub2.
If I copy Task1 with subtask, the relation between the subtask aren't copied to the new ones.
Files
| 0001-models-issue-copy-subtask-issue-relationships.patch (2.92 KB) 0001-models-issue-copy-subtask-issue-relationships.patch | models/issue: copy subtask issue relationships | Robert Beckett, 2018-04-06 19:33 | |
| #17068-copy-subtask-issue-relationships_for5.3.1.patch (2.81 KB) #17068-copy-subtask-issue-relationships_for5.3.1.patch | Markus Boremski, 2024-08-30 12:57 | ||
| #17068_issue_copy_subtask_relations-6.1-stable.patch (3.05 KB) #17068_issue_copy_subtask_relations-6.1-stable.patch | Markus Boremski, 2026-09-30 12:34 |
Related issues
Updated by Toshi MARUYAMA over 12 years ago
- Related to Defect #15742: No warning when copying subtasks to another project with different trackers added
Updated by Robert Beckett over 8 years ago
- File 0001-models-issue-copy-subtask-issue-relationships.patch 0001-models-issue-copy-subtask-issue-relationships.patch added
I Created a patch against 3.4 stable to implement copying subtask interrelations.
It applies cleanly to master.
I have been unable to test on master yet due to issues with updating rails (dependency problems for actionpack-xml_parser. Ill do this if I ever get time allotted to continue upstream effort, but as I am doing this as part of my (very busy) day job, I doubt that will happen any time soon, so if anyone wants to take this patch and test it on master, I would be grateful.
This patch is currently working fine on our live 3.4 server.
Updated by Markus Boremski about 2 years ago
- File #17068-copy-subtask-issue-relationships_for5.3.1.patch #17068-copy-subtask-issue-relationships_for5.3.1.patch added
This unfortunately still applies to the latest redmine-release.
So I made this patch Work for redmine 5.1.3
Can we please fix this defect in main?
Should be an easy fix thanks to the base of Robert Beckett.
Updated by Jairo Llopis over 1 year ago
This is a very important issue for us. Is there anything we can do to help implementing it? Thanks!
Updated by Markus Boremski 5 days ago
- File #17068_issue_copy_subtask_relations-6.1-stable.patch #17068_issue_copy_subtask_relations-6.1-stable.patch added
This unfortunately still applies to the latest Redmine releases.
I have verified the behaviour against 6.1-stable (6.1.4) and current master (7.0.1 as of 2026-09-29): when copying an issue together with its subtasks, the subtasks are copied, but the relations between them (precedes/follows, blocks/blocked, relates to, ...) are silently dropped. Issue#after_create_from_copy only recreates the subtask tree, not the relations among the copied children.
Attached is a patch (issue_copy_subtask_relations-6.1-stable.patch, apply with patch -p1 from the Redmine root) that fixes this:
- after_create_from_copy now keeps a mapping from each original child issue to its copy (instead of only the ids)
- after all subtasks have been created, a second pass walks the descendants again and recreates every relation whose both ends are part of the copied subtree,
using the same relation_type relations pointing to issues outside the copied subtree are intentionally left untouched, so no new links to unrelated issues are created - if a relation cannot be saved (validation error), it is logged and skipped, the copy itself is not aborted
The original idea dates back to a patch we have been carrying against 5.1.3.
This one has been regenerated against 6.1-stable.
It would be great if this could be considered for inclusion in the core, as the current behaviour makes copying template issues with dependent subtasks quite error-prone.