# Bug OP-11720 - Work-package relationship are lost when copying

Project: OpenProject
Status: closed
URL: https://community.openproject.org/work_packages/OP-11720

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Module |  |
| Target versions | 13.1.0 |
| Observed in versions | 12.4.0 |
| Sprint | 13.1.0 |
| Backlog bucket |  |
| Bug found in version (deprecated) | 12.4.x |
| Found in mobile app version |  |
| Follow-up feedback e-mail |  |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Developers |  |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

| Attribute | Value |
| --- | --- |
| Relevance |  |

## Costs

| Attribute | Value |
| --- | --- |
| Votes |  |
| Work |  |
| Labor costs |  |

## Description

### **Steps to reproduce**

1.  Create work-package A
2.  Create work-package B
3.  Create a relation of type T between A and B
4.  Bulk-copy A and B as A' and B'

### What is the buggy behavior?

  - The relation T between A' and B' (copied versions) is not preserved

### What is the expected behavior?

1.  Relational information between A' and B' is retained (like when moving in bulk)
2.  Should work with all types of relationships (e.g. parent-child, follows-preceeds, etc.)

### Details

  - add behavior of copying relationships to <https://github.com/opf/openproject/blob/dev/app/services/work\_packages/bulk/copy\_service.rb>
  - ~~add a checkmark to disallow/allow the current behavior~~

### Context

Using complete work-package trees as templates (e.g. via a category) is a common work-around. Unfortunately, copying (i.e. instantiating) such a template does not retain all relational information (follows etc.) among the copies as they were in the template.

### Out of scope

This bugfix won't introduce any options to let users pick if relations between original and copied work packages should be preserved. This will be dealt in a separate feature:

<mention class="mention" data-id="49870" data-type="work_package" data-text="###49870">###49870</mention>
