Try ERPNext Buy Support Partners Foundation

V-12 [HR] [Auto Attendance] Purpose of last_sync_of_checkin in Shift Type

Hello everyone. Has anyone used the auto-attendance feature in with Shift Type and Employee Checkin doctypes?

I wanted to know what is the purpose of last_sync_of_checkin field. Read the documentation also but not able to fully understand it’s purpose.
If anyone could help and shed some light on this.
Thanks.

Hi,

This field means the date and time will be updated whenever the data from the device is synced. Let’s say if the data is synced every 5 hours, then the updated time and date will reflect here

Regards,
Reema

Hi,
If I leave this field empty, then auto attendance doesn’t get marked. It works when I set the value to a datetime after current day shift ends.

e.g. my actual shift end for today is 2019-09-19 19:00:00. If I set last_sync_of_checkin to 2019-09-19 19:00:01 , then it will work correctly.

My question is do I have to update this field manually everyday? Because I couldn’t find any code reference where this field is getting auto-updated.

Best regards

Hi,

No you do not have to do it manually everyday, the field should be updated on its own when the device is synced. Currently, the logs are getting synced but the field id not updated. Looks like a small fix.

Regards,
Reema

@kartik, This field has to be updated by the script/person(in case of manual entry) actually making the Employee Checkin Records. It is not possible to reliably determine if all the data has been synched from a biometric device to ERPNext from within ERPNext, especially in multi-device scenario (At least not without assuming stuff).

Hence, you wouldn’t find any reference to code updating this field in ERPNext code base.

How are you currently updating the Employee Checkin records?

In case you are using this script, it now updates this field for you after the sync is complete. All you have to do is setup the 'shift_type_device_mapping' in the config.

PS:
On second thought, it should be possible to update this field from within ERPNext by assuming only minimal stuff, if ‘shift-device-mapping’ is provided… :thinking:… we can probably add this function to ERPNext with minimal changes and get this working… But, adding this feature within ERPNext comes with a few minor drawbacks which should be a non-issue for most scenarios.

I am using a mobile app to update employee checkin.
From my understanding by testing, attendance is marked for the dates before that datetime set in this field.
Is this the intended flow? I am having difficulty understanding the reasoning behind this.

Yes @kartik, That is the intended flow…

Here is the reasoning behind this:
Since, ERPNext is completely unaware of the system that pushes the Employee Checkin, It is not possible to determine if there is ‘Nothing to sync’(meaning the employee was absent) (or) it is ‘yet to sync’(meaning syncing is delayed due to some reason)… In the latter scenario, if we assume that the syncing has happened and mark the attendance as absent for an employee, wouldn’t that be undesirable?

1 Like

Thanks. This helps.
Although I feel the description of the field should include this fact that attendance will be marked before the datetime set.