[FIX] project: dup with subtask in another project

Enable the subtasks in the settings. Create two project "A" and "B",
create two tasks "A.a" and "B.b". Set the parent task of "B.b" to "A.a".

╭─ Project A ─╮         ╭─ Project B ─╮
│             │┏━parent━┿━━━▶ B.b     │
│     A.a ━━━━┿┛        ╰─────────────╯
╰─────────────╯

In normal situation, each task and subtasks are in the same subproject,
in such case, the parent task has been duplicated and it is important to
relink duplicated subtasks to the new parent task. In the case the
parent task is not within the current project, the subtask cannot be
relinked to a duplicated parent as it does not exist.

We could either let the link as is or remove it, we decided to remove
the link.

opw-2037623

closes odoo/odoo#35023

Signed-off-by: Julien Castiaux <Julien00859@users.noreply.github.com>
This commit is contained in:
Julien Castiaux
2019-07-19 19:44:09 +00:00
parent 5621ae3d6b
commit 8a6e2caa04
+1 -1
View File
@@ -292,7 +292,7 @@ class Project(models.Model):
defaults = self._map_tasks_default_valeus(task)
if task.parent_id:
# set the parent to the duplicated task
defaults['parent_id'] = old_to_new_tasks[task.parent_id.id]
defaults['parent_id'] = old_to_new_tasks.get(task.parent_id.id, False)
new_task = task.copy(defaults)
old_to_new_tasks[task.id] = new_task.id
tasks += new_task