Hi there @shreyasp,
I am having trouble regarding uploading attendance.
The error is something i havent come across earlies and i am unable to solve it either.
The thing is i have added a custom field in attendance module time_in and time_out. so i marked the status as absent if both the field is not present.
So as you can see i have an error on row 9 and 10, as they dont have time in and time_out value. Ill paste the script as well for you to understand it better.
r[9] value is time_in and r[10] value is time-out
for i, row in enumerate(rows[5:]):
if not row: continue
row_idx = i + 5
d = frappe._dict(zip(columns, row))
d[“doctype”] = “Attendance”
if d.name:
d[“docstatus”] = frappe.db.get_value(“Attendance”, d.name, “docstatus”)
try:
check_record(d)
if row[9] not in (None,'') or row[10] not in (None,''):
ret.append(import_doc(d, "Attendance", 1, row_idx, submit=True))
else:
print "Either Draft Mode."
ret.append(import_doc(d, "Attendance", 1, row_idx, submit=False))
except Exception, e:
error = True
ret.append('Error for row (#%d) %s : %s' % (row_idx+1,
len(row)>1 and row[1] or "", cstr(e)))
frappe.errprint(frappe.get_traceback())
if error:
frappe.db.rollback()
else:
frappe.db.commit()
return {"messages": ret, "error": error}