[FIX] sale_timesheet: include correct empty lines in overview

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) <jem@openerp.com>
This commit is contained in:
jem-odoo
2019-04-03 13:55:39 +00:00
parent b28d14bf08
commit e24a16858d
@@ -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, ...