From e24a16858dc02ec3a6f1adff8c806d58a8a5090f Mon Sep 17 00:00:00 2001 From: jem-odoo Date: Wed, 3 Apr 2019 13:52:04 +0000 Subject: [PATCH] [FIX] sale_timesheet: include correct empty lines in overview MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When confirming a second SO, with its project set as the project of a previous SO (so they can share the same project, and all their task created end up in the same project), we want to see the sales line without timesheet on the table of the project overview. Before this commit, it only takes the empty lines of the origin sales order, not the ones from the second. This commit fixes that by including 2nd SO's service lines in the empty lines to display. Task-1915660 closes odoo/odoo#32391 Signed-off-by: Jérome Maes (jem) --- addons/sale_timesheet/models/project_overview.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/sale_timesheet/models/project_overview.py b/addons/sale_timesheet/models/project_overview.py index 86a70fd30d2..af275ba9a3b 100644 --- a/addons/sale_timesheet/models/project_overview.py +++ b/addons/sale_timesheet/models/project_overview.py @@ -321,7 +321,9 @@ class Project(models.Model): def _table_get_empty_so_lines(self): """ get the Sale Order Lines having no timesheet but having generated a task or a project """ so_lines = self.sudo().mapped('sale_line_id.order_id.order_line').filtered(lambda sol: sol.is_service and not sol.is_expense) - return set(so_lines.ids), set(so_lines.mapped('order_id').ids) + # include the service SO line of SO sharing the same project + sale_order = self.env['sale.order'].search([('project_id', 'in', self.ids)]) + return set(so_lines.ids) | set(sale_order.mapped('order_line').filtered(lambda sol: sol.is_service and not sol.is_expense).ids), set(so_lines.mapped('order_id').ids) | set(sale_order.ids) # -------------------------------------------------- # Actions: Stat buttons, ...