[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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user