-
- Downloads
[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:Yannick Tivisse (yti) <yti@odoo.com> Co-authored-by:
MaxLarue <mla@odoo.com>
Showing
- addons/project/models/project.py 21 additions, 53 deletionsaddons/project/models/project.py
- addons/sale_timesheet/models/project.py 17 additions, 47 deletionsaddons/sale_timesheet/models/project.py
- addons/sale_timesheet/tests/__init__.py 1 addition, 0 deletionsaddons/sale_timesheet/tests/__init__.py
- addons/sale_timesheet/tests/test_child_tasks.py 216 additions, 0 deletionsaddons/sale_timesheet/tests/test_child_tasks.py
- addons/sale_timesheet/tests/test_sale_service.py 1 addition, 1 deletionaddons/sale_timesheet/tests/test_sale_service.py
- addons/sale_timesheet/views/project_task_views.xml 1 addition, 0 deletionsaddons/sale_timesheet/views/project_task_views.xml
Loading
Please register or sign in to comment