Try ERPNext Buy Support Partners Foundation

Error in Attendance entry for approved Leave

Hello, an employee applied for one day sick leave which was approved but Half Day was recorded in Attendance:

Attendance report showed leave as half day:

I checked the monthly_attendance_report.py and this is what i found:

if not filters.get(“employee”):
filters.update({“employee”: emp})
conditions += " and employee = %(employee)s"
elif not filters.get(“employee”) == emp:
filters.update({“employee”: emp})
leave_details = frappe.db.sql(""“select leave_type, status, count(*) as count from tabAttendance
where leave_type is not NULL %s group by leave_type, status”"" % conditions, filters, as_d$
leaves = {}
for d in leave_details:
if d.status == “Half Day”:
d.count = d.count * 0.5
if d.leave_type in leaves:
leaves[d.leave_type] += d.count
else:
leaves[d.leave_type] = d.count
for d in leave_list:
if d in leaves:
row.append(leaves[d])
else:
row.append(“0.0”)
data.append(row)
return columns, data

How can i correct this error

Hi,

Did employee work for half day? If yes, what happens if you try making Half Day leave application?

Was Leave Application submitted? If no, then it should not be considered as a leave.

@Zlash65 could you check?

No the employee didn’t work half a day. This clearly shows on the screenshot i sent in the last post that employee applied for 1 day.

Leave application was duly submitted and approved and the attendance entry was subsequently made automatically after the approval. The attendance entry is where the issue is. It registered the leave approved as half day even though the leave approved itself shows that it was one full day.

Hi,

I also have the same issue ! Please let me know if there’s a solution

Check for or report the issue here https://github.com/frappe/erpnext/issues