Skip to content
Snippets Groups Projects
Commit 2dccf4d6 authored by Lucas Lefèvre's avatar Lucas Lefèvre
Browse files

[IMP] project: Use stored computed fields for parent to children task


Purpose
=======
When you create a task independently and link it to a Parent task later on,
several changes are applied: the person assigned on the sub-task switches
to the one set on the parent task, same for the customer, and so on.
This creates frustration because the user most likely set specific data on the
sub task for a reason. In addition, the changes are made implicitely, so the
user might not notice it or get confused as to what changed from the original
task.

Specification
=============
Values for fields `partner_id`, `email_from`, `project_id`, `sale_line_id` should be
transfered from parent task to children task, only if the value is not already set
on the child.

This was already partially implemented by 749810a2 and 45396f79.
But to achieve it, similar code was duplicated in several methods:
default_get, onchanges, write, create.

Since the new ORM, the same behavior can be achieved with only computed fields
with store=True and readonly=False. This commit changes the previous implementation
to take advantage of this which greatly improves code readability and maintainability.

Tests by Maximilen Larue
Business code by Lucas Lefèvre

closes odoo/odoo#39369

Signed-off-by: default avatarYannick Tivisse (yti) <yti@odoo.com>
Co-authored-by: default avatarMaxLarue <mla@odoo.com>
parent 32f14b91
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment