ERPNext Foundation ERPNext Cloud Chat Blog Discuss Frappé* Donate

Time datatype default value


Hi all ,
i`m working on Time attendance App .
and i have fields like attend_time and leave_time with datatype (Time)
but when i try to make new doc and insert in attendance doctype with one them the other take time to now and does not take null value
even if i try to set the value to empty from the attendance doctype does not take empty value
please help :frowning:

def add_attendance(employee, status, date, attend_time=None, leave_time=None, late_minutes=0.0, attend_notes=None, leave_type=None):
		attendance = frappe.new_doc("Attendance")
		attendance.employee = employee['employee']
		attendance.employee_name = employee['employee_name']
		attendance.attendance_date = date
		attendance.attend_time = attend_time
		attendance.leave_time = leave_time
		attendance.delay_minutes = late_minutes
		attendance.notes = attend_notes
		attendance.status = status = frappe.db.get_value("Employee", employee['employee'], "Company")

		if status == "On Leave" and leave_type:
			attendance.leave_type = leave_type


it cannot be empty, instead you can set 0 value to it.
frm.set_value(“attend_time”, “0”);


i put

elif df.fieldtype == "Time" and d[fieldname] == "":
	d[fieldname] = None

in function get_valid_dict(self, sanitize=True, convert_dates_to_str=False) in file
and it works