I want to code for auto attendance, how i can

basically i want to do,when employee check IN/OUT then in attendance module ,there have to be present , if employee is late ,than automaticaly check the box for late entry
check box, can anyone solve it.


This functionality is available out of box.

Just Define the Shift Type, assign the shift to the employee and enable parameter mark auto attendance in shift type.

This should give you the desired results.


i tried ,but that functionality is working on with biomatric device…
i want to do without biomatric.

How you are managing employee check in/out ?

manually from admin side and also user side .


This will still work, if you are capturing time in check in record.

You need to manually update the Last Sync date and time in a Shift Type documents after capturing all the check in record and click on the button Mark Attendance on Shift Type document.


what time and date to consider in ‘‘Last Sync of Checkin’’ column

Normally it should be the date and time after the time of your shift ends.

For example your shift ends at 17:00 hours, then you can set the 05-June-2023 19:00 hrs to Mark Attendance till yesterday.


your solution is working :+1:
but i dont want to click “mark attendance” every time in “shift time doctype”.
do you have any sctipt


Background task is running every hour, so you no need to click on button manually.

You can update the Last Sync of Check in also automatically via below server script:

s = frappe.get_doc('Shift Type','Morning')
s.last_sync_of_checkin =  frappe.utils.add_to_date(frappe.utils.today(), days=-1, as_string=True) + ' 23:59:59'

Create server script with above code and select Script Type - Scheduler Event and Event Frequency- Daily.

This script will run at midnight and update the last sync for yesterday and time you can modify as per your requirement.


1 Like