Skip to content

Commit

Permalink
fix: don't show any records in calendar if not employee
Browse files Browse the repository at this point in the history
  • Loading branch information
asmitahase committed Feb 4, 2025
1 parent e0dd970 commit 7483e09
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion hrms/hr/doctype/attendance/attendance.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@ def unlink_attendance_from_checkins(self):

@frappe.whitelist()
def get_events(start, end, filters=None):
employee = frappe.db.get_value("Employee", {"user_id": frappe.session.user})
if not employee:
return []
if isinstance(filters, str):
import json

Expand All @@ -236,7 +239,6 @@ def get_events(start, end, filters=None):
filters.append(["attendance_date", "between", [get_datetime(start).date(), get_datetime(end).date()]])

attendance_records = add_attendance(filters)
employee = frappe.db.get_value("Employee", {"user_id": frappe.session.user})
add_holidays(attendance_records, start, end, employee)
return attendance_records

Expand Down

0 comments on commit 7483e09

Please sign in to comment.