Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.
Module: Sales - Project
Entity: project.task
Compute Method: _compute_sale_line
| Inputs | Method | Outputs |
|---|---|---|
|
for task in self:
if not (task.allow_billable or task.parent_id.allow_billable):
task.sale_line_id = False
continue
if not task.sale_line_id:
# if the project_id is set then it means the task is classic task or a subtask with another project than its parent.
# To determine the sale_line_id, we first need to look at the parent before the project to manage the case of subtasks.
# Two sub-tasks in the same project do not necessarily have the same sale_line_id (need to look at the parent task).
sale_line = False
if task.parent_id.sale_line_id and task.parent_id.partner_id.commercial_partner_id == task.partner_id.commercial_partner_id:
sale_line = task.parent_id.sale_line_id
+ elif task.milestone_id.sale_line_id:
+ sale_line = task.milestone_id.sale_line_id
elif task.project_id.sale_line_id and task.project_id.partner_id.commercial_partner_id == task.partner_id.commercial_partner_id:
sale_line = task.project_id.sale_line_id
- task.sale_line_id = sale_line or task.milestone_id.sale_line_id
- # check sale_line_id and customer are coherent
- if task.sale_line_id.order_partner_id.commercial_partner_id != task.partner_id.commercial_partner_id:
- task.sale_line_id = False
+ task.sale_line_id = sale_line
|
|
