[FIX] sale_project: add Tasks associated to SO in Tasks smart button

- Install sale_project
- Go to Project > All Tasks and open an Task
- Toggle Studio:
  * Activate "Show invisible elements" in View menu tab
  * Select "Sales Order" field and uncheck invisible option
- Go to Sales and create a Quotation (i.e. SO0001)
- Go to Project > All Tasks and create a Task with SO0001 as SO
- Go back to Quotation SO0001
The created Task is not counted in the Tasks smart button.

Tasks smart button on SO only shows Tasks associated to a SO line
and does not show Tasks associated to SO.

opw-2335040

closes odoo/odoo#58926

X-original-commit: 1ffa2b5677d028c51a06f884d635cd8429730aae
Signed-off-by: Anh Thao PHAM <kitan191@users.noreply.github.com>
This commit is contained in:
Anh Thao Pham (pta)
2020-10-01 12:30:38 +00:00
parent 6d99a50012
commit 24a07e6124
+1 -1
View File
@@ -21,7 +21,7 @@ class SaleOrder(models.Model):
@api.depends('order_line.product_id.project_id')
def _compute_tasks_ids(self):
for order in self:
order.tasks_ids = self.env['project.task'].search([('sale_line_id', 'in', order.order_line.ids)])
order.tasks_ids = self.env['project.task'].search(['|', ('sale_line_id', 'in', order.order_line.ids), ('sale_order_id', '=', order.id)])
order.tasks_count = len(order.tasks_ids)
@api.depends('order_line.product_id.service_tracking')