'Links the timesheet line to the corresponding sheet'

@api.depends('date', 'user_id', 'project_id', 'sheet_id_computed.date_to', 'sheet_id_computed.date_from', 'sheet_id_computed.employee_id')
def _compute_sheet(self):

    for ts_line in self:
        if (not ts_line.project_id):
            continue
        sheets = self.env['hr_timesheet_sheet.sheet'].search([('date_to', '>=', ts_line.date), ('date_from', '<=', ts_line.date), ('employee_id.user_id.id', '=', ts_line.user_id.id), ('state', 'in', ['draft', 'new'])])
        if sheets:
            ts_line.sheet_id_computed = sheets[0]
            ts_line.sheet_id = sheets[0]
