I am trying to use the Biometric Attendance Sync Tool (https://github.com/frappe/biometric-attendance-sync-tool) to synchronize attendance data from a local machine to ERPNext hosted on Frappe Cloud. The synchronization process is working, and all data is being posted successfully except for the time field.
The issue I am facing is that the time from the biometric device is not being fetched correctly. Instead, the current time (local machine time) is being used for the time field in ERPNext. I have checked the tool's configuration and ensured that the time zone settings are correct.
Has anyone encountered a similar issue? Is there a way to ensure that the time from the biometric device is accurately synced with ERPNext? Any guidance or suggestions would be greatly appreciated.
Thank you in advance for your help!
I tried a custom script to check the same and please find the details below.
Check the response status code and print the result
if response.status_code == 200:
print("Data sent successfully!")
print(response.json())
else:
print("Failed to send data to ERPNext.")
print(response.text)
I am trying to use the Biometric Attendance Sync Tool (https://github.com/frappe/biometric-attendance-sync-tool) to synchronize attendance data from a local machine to ERPNext hosted on Frappe Cloud. The synchronization process is working, and all data is being posted successfully except for the time field.
The issue I am facing is that the time from the biometric device is not being fetched correctly. Instead, the current time (local machine time) is being used for the time field in ERPNext. I have checked the tool's configuration and ensured that the time zone settings are correct.
Has anyone encountered a similar issue? Is there a way to ensure that the time from the biometric device is accurately synced with ERPNext? Any guidance or suggestions would be greatly appreciated.
Thank you in advance for your help!
I tried a custom script to check the same and please find the details below.
import requests import json
Enter your ERPNext API credentials and URL
ERPNEXT_API_KEY = 'your_api_key' ERPNEXT_API_SECRET = 'your_api_secret' ERPNEXT_URL = 'your_erpnext_url'
Data to send to ERPNext
data = { 'employee_field_value': '20018', 'timestamp': '2024-04-25 17:04:34', 'device_id': 'deskdevice', 'log_type': 'IN' }
ERPNext endpoint and headers
endpoint = f"{ERPNEXT_URL}/api/method/hrms.hr.doctype.employee_checkin.employee_checkin.add_log_based_on_employee_field" headers = { 'Authorization': f"token {ERPNEXT_API_KEY}:{ERPNEXT_API_SECRET}", 'Accept': 'application/json', 'Content-Type': 'application/json' }
Send a POST request to ERPNext with the data
response = requests.post(endpoint, headers=headers, json=data)
Check the response status code and print the result
if response.status_code == 200: print("Data sent successfully!") print(response.json()) else: print("Failed to send data to ERPNext.") print(response.text)
Data sent successfully! {'message': {'name': 'EMP-CKIN-04-2024-000009', 'owner': 'email id masked', 'creation': '2024-04-26 15:43:51.149027', 'modified': '2024-04-26 15:43:51.149027', 'modified_by': 'email id masked', 'docstatus': 0, 'idx': 0, 'employee': 'IDH-0001', 'employee_name': 'Employee', 'log_type': 'IN', 'shift': 'Office Shift', 'time': '2024-04-26 15:43:51.153962', 'device_id': 'deskdevice', 'skip_auto_attendance': 0, 'shift_start': '2024-04-26 08:00:00', 'shift_end': '2024-04-26 17:00:00', 'shift_actual_start': '2024-04-26 06:00:00', 'shift_actual_end': '2024-04-27 00:00:00', 'doctype': 'Employee Checkin'}}