Files
odoo_source/addons/sale_project
lase@odoo.com 85a75d2d82 [FIX] project: assign copied task to copied project
Steps to reproduce:

- Create a project with a task with a sub-task
- Assign manually the sub-task to the project
- Create a product that creates a project based on this product template
- Create an SO with that product

> A copy of your project template will be created and assigned to the SO

Expected Behavior:

Just as in 16.4, the copy of the subtask created during this process
should be associated with the copy of your project template.

Current Behavior:

The subtask is associated with the original project template.

Cause of the issue/Fix:

Confirming the SO will call the copy method on your project template.
During this call copies of its task and sub-task will be created and
should then be remapped to the correct project/task using by the
`map_tasks` method call:
https://github.com/odoo/odoo/blob/f31174e02157e612650e77ebba3ed1fe54b96776/addons/project/models/project_project.py#L436-L437
This use to do the job correctly in 16.4 because of these lines:
https://github.com/odoo/odoo/blob/ce28edbaae5a9af0a8c6e1f2addf4285ec56e9e1/addons/project/models/project_project.py#L415-L419
However, these were removed by Commit 62e53fa, probably because the new
write method of the "project.project" model introduced by this commit
sometimes relies on the "project_id" of these tasks and this information
should be consistent with the future value of the  "project_id" of these
tasks. However, the "project_id" of these tasks should still be remapped
to the copied project at some point and in my opinion this should be
done before the new write method is called, so that this method can be
used correctly.

opw-3823013

closes odoo/odoo#160625

Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2024-04-16 08:36:04 +00:00
..