Dear All.
I created a doctype books.
Added a field to set the level.
Created a webform to display the list of books.
Added a field to the user to specify the level.
I want to filter the webform based on the level of the logged in user.
Can anyone provide with a hint on how to accomplich this functionality?
def get_book_list(doctype, txt, filters, limit_start, limit_page_length = 20, order_by=‘modified desc’):
userlevel = get_login_level()
books = frappe.db.sql(“”“select * from tabBooks
where level = %s order by creation desc”“”, userlevel, as_dict = True)
return books
def get_login_level():
level= frappe.db.sql(“”“select level from tabStudent Level
where name1 = %s order by creation desc”“”, frappe.session.user)
return level