'Get to-do list'

def get_todo_list(self, user_id=None):

    if (not user_id):
        user_id = frappe.session.user
    todo_list = frappe.db.sql(u'select    *\n DCTB  DCTB  DCTB from    `tabToDo`    where    (owner=%s    or    assigned_by=%s)    and    status="Open"\n DCTB  DCTB  DCTB order    by    field(priority,    \'High\',    \'Medium\',    \'Low\')    asc,    date    asc    limit    20', (user_id, user_id), as_dict=True)
    for t in todo_list:
        t.link = get_url_to_form(u'ToDo', t.name)
    return todo_list
