From 8060abafbc5537d0cbb9aebb92ad8a5cdcd8ce79 Mon Sep 17 00:00:00 2001 From: Urvi Soni Date: Tue, 2 Jun 2020 10:24:23 +0000 Subject: [PATCH] [FIX] sale_timesheet: Display of SOL field on task only if timesheet exist. Currently, the SOL field is visible on task form view even if there are no timesheets linked to the task. So in this commit the SOL field should not be visible on task form view if there are no timesheets linked to the task. The SOL field is only visible incase when there is multiple soline is linked with timesheet so to make that field visibile/invisible there is has_multi_sol compute field. so we will only display the field if timesheet_id is exist. closes odoo/odoo#52218 Taskid: 2266104 Closes: #52218 Signed-off-by: Yannick Tivisse (yti) --- addons/sale_timesheet/models/project.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale_timesheet/models/project.py b/addons/sale_timesheet/models/project.py index 4cf6b451ca6..da7a5926053 100644 --- a/addons/sale_timesheet/models/project.py +++ b/addons/sale_timesheet/models/project.py @@ -246,7 +246,7 @@ class ProjectTask(models.Model): @api.depends('timesheet_ids') def _compute_has_multi_sol(self): for task in self: - task.has_multi_sol = task.timesheet_ids.so_line != task.sale_line_id + task.has_multi_sol = task.timesheet_ids and task.timesheet_ids.so_line != task.sale_line_id @api.onchange('project_id') def _onchange_project(self):