I’m new with ERPnext and python, i was confuse on how to set a value of table attribute into variable in python?
here is the snippet which i got from monthly_attendance_sheet.py file from erpnext folder:
def get_attendance_list(conditions, filters):
attendance_list = frappe.db.sql("""select employee, day(att_date) as day_of_month,
status, time_in , time_out from tabAttendance where docstatus = 1 %s order by employee, att_date""" %
conditions, filters, as_dict=1)
att_map = {}
for d in attendance_list:
att_map.setdefault(d.employee, frappe._dict()).setdefault(d.day_of_month, "")
att_map[d.employee][d.day_of_month] = d.status
return att_map
as you can see I just add time_in and time_out custom fields to the table, and now trying to get this value from the table and set this value to an attribute, because im going to have the average time in and time out of each employee in each month.
If you need more snippets or even the file, i can email you.
NEED HELP
i want to have a variable that has the value of (time in) attribute and (time out) attribute
example:
x = #value of (time in) such as 13:00:00
y = #value of (time out) such as 15:00:00
this (time in) and (time out) is an attribute of “tabAttendance” table.
looks like the example i gave, erpnext do set their employee attribute value , month and status so that they can print or use it. but i dont understand that code. can you help me?