Connection ZKTeco with ERPNext

Thanks a lot for your perfect video. When I run the file “erpnext_sync.py” as https://youtu.be/KhfncWCcu68?t=277 It shows Service Running" only and didnt show any data behind “Service Dunning” and also without any change at ERPNext.

Thanks a lot for your perfect video. When I run the file “erpnext_sync.py” as https://youtu.be/KhfncWCcu68?t=277 It shows Service Running" only and didnt show any data behind “Service Dunning” and also without any change at ERPNext.

Hi.

I know that this is an old post. But I need help. I am facing the following Error.

I am using Version 14, I have updated it from version 13. The script was working fine in the version 13. However when I upgraded, I lost all the data, I had to input all the data again. Now the syincing is not working. Can anyone help me in this error.

Yes I have checked the API Secret, it is same in the ERP as well as in the local_config.py file

To cut short, following is the error.

ModuleNotFoundError: No module named ‘erpnext.hr.doctype.employee_checkin.employee_checkin’

2023-03-30 02:39:16,383 ERROR Error during ERPNext API Call. 1 1666863029.0 4th Floor IN Traceback (most recent call last):
File “apps/frappe/frappe/handler.py”, line 72, in execute_cmd
method = get_attr(cmd)
File “apps/frappe/frappe/handler.py”, line 258, in get_attr
method = frappe.get_attr(cmd)
File “apps/frappe/frappe/init.py”, line 1577, in get_attr
return getattr(get_module(modulename), methodname)
File “apps/frappe/frappe/init.py”, line 1319, in get_module
return importlib.import_module(modulename)
File “/usr/lib/python3.10/importlib/init.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1050, in _gcd_import
File “”, line 1027, in _find_and_load
File “”, line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named ‘erpnext.hr.doctype.employee_checkin.employee_checkin’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “apps/frappe/frappe/app.py”, line 69, in application
response = frappe.api.handle()
File “apps/frappe/frappe/api.py”, line 54, in handle
return frappe.handler.handle()
File “apps/frappe/frappe/handler.py”, line 45, in handle
data = execute_cmd(cmd)
File “apps/frappe/frappe/handler.py”, line 74, in execute_cmd
frappe.throw(_(“Failed to get method for command {0} with {1}”).format(cmd, e))
File “apps/frappe/frappe/init.py”, line 522, in throw
msgprint(
File “apps/frappe/frappe/init.py”, line 490, in msgprint
_raise_exception()
File “apps/frappe/frappe/init.py”, line 442, in _raise_exception
raise raise_exception(msg)
frappe.exceptions.ValidationError: Failed to get method for command erpnext.hr.doctype.employee_checkin.employee_checkin.add_log_based_on_employee_field with No module named ‘erpnext.hr.doctype.employee_checkin.employee_checkin’

2023-03-30 02:39:16,384 ERROR exception when calling pull_process_and_push_data function for device{“device_id”: “4th Floor”, “ip”: “192.168.56.31”, “punch_direction”: “AUTO”, “clear_from_device_on_fetch”: false}
Traceback (most recent call last):
File “/home/frappe/myfrappe/sites/push-biometric-erpnext/erpnext_sync.py”, line 60, in main
pull_process_and_push_data(device, device_attendance_logs)
File “/home/frappe/myfrappe/sites/push-biometric-erpnext/erpnext_sync.py”, line 138, in pull_process_and_push_data
raise Exception(‘API Call to ERPNext Failed.’)
Exception: API Call to ERPNext Failed.
2023-03-30 02:39:16,427 ERROR Error during ERPNext API Call. 3812 1668675799.0 3rd Floor IN Traceback (most recent call last):
File “apps/frappe/frappe/handler.py”, line 72, in execute_cmd
method = get_attr(cmd)
File “apps/frappe/frappe/handler.py”, line 258, in get_attr
method = frappe.get_attr(cmd)
File “apps/frappe/frappe/init.py”, line 1577, in get_attr
return getattr(get_module(modulename), methodname)
File “apps/frappe/frappe/init.py”, line 1319, in get_module
return importlib.import_module(modulename)
File “/usr/lib/python3.10/importlib/init.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1050, in _gcd_import
File “”, line 1027, in _find_and_load
File “”, line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named ‘erpnext.hr.doctype.employee_checkin.employee_checkin’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “apps/frappe/frappe/app.py”, line 69, in application
response = frappe.api.handle()
File “apps/frappe/frappe/api.py”, line 54, in handle
return frappe.handler.handle()
File “apps/frappe/frappe/handler.py”, line 45, in handle
data = execute_cmd(cmd)
File “apps/frappe/frappe/handler.py”, line 74, in execute_cmd
frappe.throw(_(“Failed to get method for command {0} with {1}”).format(cmd, e))
File “apps/frappe/frappe/init.py”, line 522, in throw
msgprint(
File “apps/frappe/frappe/init.py”, line 490, in msgprint
_raise_exception()
File “apps/frappe/frappe/init.py”, line 442, in _raise_exception
raise raise_exception(msg)
frappe.exceptions.ValidationError: Failed to get method for command erpnext.hr.doctype.employee_checkin.employee_checkin.add_log_based_on_employee_field with No module named ‘erpnext.hr.doctype.employee_checkin.employee_checkin’

2023-03-30 02:39:16,428 ERROR exception when calling pull_process_and_push_data function for device{“device_id”: “3rd Floor”, “ip”: “192.168.50.17”, “punch_direction”: “AUTO”, “clear_from_device_on_fetch”: false}
Traceback (most recent call last):
File “/home/frappe/myfrappe/sites/push-biometric-erpnext/erpnext_sync.py”, line 60, in main
pull_process_and_push_data(device, device_attendance_logs)
File “/home/frappe/myfrappe/sites/push-biometric-erpnext/erpnext_sync.py”, line 138, in pull_process_and_push_data
raise Exception(‘API Call to ERPNext Failed.’)
Exception: API Call to ERPNext Failed.
2023-03-30 02:40:16,529 ERROR Error during ERPNext API Call. 1 1666863029.0 4th Floor IN Traceback (most recent call last):
File “apps/frappe/frappe/handler.py”, line 72, in execute_cmd
method = get_attr(cmd)
File “apps/frappe/frappe/handler.py”, line 258, in get_attr
method = frappe.get_attr(cmd)
File “apps/frappe/frappe/init.py”, line 1577, in get_attr
return getattr(get_module(modulename), methodname)
File “apps/frappe/frappe/init.py”, line 1319, in get_module
return importlib.import_module(modulename)
File “/usr/lib/python3.10/importlib/init.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1050, in _gcd_import
File “”, line 1027, in _find_and_load
File “”, line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named ‘erpnext.hr.doctype.employee_checkin.employee_checkin’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “apps/frappe/frappe/app.py”, line 69, in application
response = frappe.api.handle()
File “apps/frappe/frappe/api.py”, line 54, in handle
return frappe.handler.handle()
File “apps/frappe/frappe/handler.py”, line 45, in handle
data = execute_cmd(cmd)
File “apps/frappe/frappe/handler.py”, line 74, in execute_cmd
frappe.throw(_(“Failed to get method for command {0} with {1}”).format(cmd, e))
File “apps/frappe/frappe/init.py”, line 522, in throw
msgprint(
File “apps/frappe/frappe/init.py”, line 490, in msgprint
_raise_exception()
File “apps/frappe/frappe/init.py”, line 442, in _raise_exception
raise raise_exception(msg)
frappe.exceptions.ValidationError: Failed to get method for command erpnext.hr.doctype.employee_checkin.employee_checkin.add_log_based_on_employee_field with No module named ‘erpnext.hr.doctype.employee_checkin.employee_checkin’

2023-03-30 02:40:16,530 ERROR exception when calling pull_process_and_push_data function for device{“device_id”: “4th Floor”, “ip”: “192.168.56.31”, “punch_direction”: “AUTO”, “clear_from_device_on_fetch”: false}
Traceback (most recent call last):
File “/home/frappe/myfrappe/sites/push-biometric-erpnext/erpnext_sync.py”, line 60, in main
pull_process_and_push_data(device, device_attendance_logs)
File “/home/frappe/myfrappe/sites/push-biometric-erpnext/erpnext_sync.py”, line 138, in pull_process_and_push_data
raise Exception(‘API Call to ERPNext Failed.’)
Exception: API Call to ERPNext Failed.
2023-03-30 02:40:16,569 ERROR Error during ERPNext API Call. 3812 1668675799.0 3rd Floor IN Traceback (most recent call last):
File “apps/frappe/frappe/handler.py”, line 72, in execute_cmd
method = get_attr(cmd)
File “apps/frappe/frappe/handler.py”, line 258, in get_attr
method = frappe.get_attr(cmd)
File “apps/frappe/frappe/init.py”, line 1577, in get_attr
return getattr(get_module(modulename), methodname)
File “apps/frappe/frappe/init.py”, line 1319, in get_module
return importlib.import_module(modulename)
File “/usr/lib/python3.10/importlib/init.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1050, in _gcd_import
File “”, line 1027, in _find_and_load
File “”, line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named ‘erpnext.hr.doctype.employee_checkin.employee_checkin’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “apps/frappe/frappe/app.py”, line 69, in application
response = frappe.api.handle()
File “apps/frappe/frappe/api.py”, line 54, in handle
return frappe.handler.handle()
File “apps/frappe/frappe/handler.py”, line 45, in handle
data = execute_cmd(cmd)
File “apps/frappe/frappe/handler.py”, line 74, in execute_cmd
frappe.throw(_(“Failed to get method for command {0} with {1}”).format(cmd, e))
File “apps/frappe/frappe/init.py”, line 522, in throw
msgprint(
File “apps/frappe/frappe/init.py”, line 490, in msgprint
_raise_exception()
File “apps/frappe/frappe/init.py”, line 442, in _raise_exception
raise raise_exception(msg)
frappe.exceptions.ValidationError: Failed to get method for command erpnext.hr.doctype.employee_checkin.employee_checkin.add_log_based_on_employee_field with No module named ‘erpnext.hr.doctype.employee_checkin.employee_checkin’

2023-03-30 02:40:16,570 ERROR exception when calling pull_process_and_push_data function for device{“device_id”: “3rd Floor”, “ip”: “192.168.50.17”, “punch_direction”: “AUTO”, “clear_from_device_on_fetch”: false}
Traceback (most recent call last):
File “/home/frappe/myfrappe/sites/push-biometric-erpnext/erpnext_sync.py”, line 60, in main
pull_process_and_push_data(device, device_attendance_logs)
File “/home/frappe/myfrappe/sites/push-biometric-erpnext/erpnext_sync.py”, line 138, in pull_process_and_push_data
raise Exception(‘API Call to ERPNext Failed.’)
Exception: API Call to ERPNext Failed.
2023-03-30 02:41:16,702 ERROR Error during ERPNext API Call. 1 1666863029.0 4th Floor IN Traceback (most recent call last):
File “apps/frappe/frappe/handler.py”, line 72, in execute_cmd
method = get_attr(cmd)
File “apps/frappe/frappe/handler.py”, line 258, in get_attr
method = frappe.get_attr(cmd)
File “apps/frappe/frappe/init.py”, line 1577, in get_attr
return getattr(get_module(modulename), methodname)
File “apps/frappe/frappe/init.py”, line 1319, in get_module
return importlib.import_module(modulename)
File “/usr/lib/python3.10/importlib/init.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1050, in _gcd_import
File “”, line 1027, in _find_and_load
File “”, line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named ‘erpnext.hr.doctype.employee_checkin.employee_checkin’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “apps/frappe/frappe/app.py”, line 69, in application
response = frappe.api.handle()
File “apps/frappe/frappe/api.py”, line 54, in handle
return frappe.handler.handle()
File “apps/frappe/frappe/handler.py”, line 45, in handle
data = execute_cmd(cmd)
File “apps/frappe/frappe/handler.py”, line 74, in execute_cmd
frappe.throw(_(“Failed to get method for command {0} with {1}”).format(cmd, e))
File “apps/frappe/frappe/init.py”, line 522, in throw
msgprint(
File “apps/frappe/frappe/init.py”, line 490, in msgprint
_raise_exception()
File “apps/frappe/frappe/init.py”, line 442, in _raise_exception
raise raise_exception(msg)
frappe.exceptions.ValidationError: Failed to get method for command erpnext.hr.doctype.employee_checkin.employee_checkin.add_log_based_on_employee_field with No module named ‘erpnext.hr.doctype.employee_checkin.employee_checkin’

2023-03-30 02:41:16,703 ERROR exception when calling pull_process_and_push_data function for device{“device_id”: “4th Floor”, “ip”: “192.168.56.31”, “punch_direction”: “AUTO”, “clear_from_device_on_fetch”: false}
Traceback (most recent call last):
File “/home/frappe/myfrappe/sites/push-biometric-erpnext/erpnext_sync.py”, line 60, in main
pull_process_and_push_data(device, device_attendance_logs)
File “/home/frappe/myfrappe/sites/push-biometric-erpnext/erpnext_sync.py”, line 138, in pull_process_and_push_data
raise Exception(‘API Call to ERPNext Failed.’)
Exception: API Call to ERPNext Failed.
2023-03-30 02:41:16,742 ERROR Error during ERPNext API Call. 3812 1668675799.0 3rd Floor IN Traceback (most recent call last):
File “apps/frappe/frappe/handler.py”, line 72, in execute_cmd
method = get_attr(cmd)
File “apps/frappe/frappe/handler.py”, line 258, in get_attr
method = frappe.get_attr(cmd)
File “apps/frappe/frappe/init.py”, line 1577, in get_attr
return getattr(get_module(modulename), methodname)
File “apps/frappe/frappe/init.py”, line 1319, in get_module
return importlib.import_module(modulename)
File “/usr/lib/python3.10/importlib/init.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1050, in _gcd_import
File “”, line 1027, in _find_and_load
File “”, line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named ‘erpnext.hr.doctype.employee_checkin.employee_checkin’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “apps/frappe/frappe/app.py”, line 69, in application
response = frappe.api.handle()
File “apps/frappe/frappe/api.py”, line 54, in handle
return frappe.handler.handle()
File “apps/frappe/frappe/handler.py”, line 45, in handle
data = execute_cmd(cmd)
File “apps/frappe/frappe/handler.py”, line 74, in execute_cmd
frappe.throw(_(“Failed to get method for command {0} with {1}”).format(cmd, e))
File “apps/frappe/frappe/init.py”, line 522, in throw
msgprint(
File “apps/frappe/frappe/init.py”, line 490, in msgprint
_raise_exception()
File “apps/frappe/frappe/init.py”, line 442, in _raise_exception
raise raise_exception(msg)
frappe.exceptions.ValidationError: Failed to get method for command erpnext.hr.doctype.employee_checkin.employee_checkin.add_log_based_on_employee_field with No module named ‘erpnext.hr.doctype.employee_checkin.employee_checkin’

2023-03-30 02:41:16,743 ERROR exception when calling pull_process_and_push_data function for device{“device_id”: “3rd Floor”, “ip”: “192.168.50.17”, “punch_direction”: “AUTO”, “clear_from_device_on_fetch”: false}
Traceback (most recent call last):
File “/home/frappe/myfrappe/sites/push-biometric-erpnext/erpnext_sync.py”, line 60, in main
pull_process_and_push_data(device, device_attendance_logs)
File “/home/frappe/myfrappe/sites/push-biometric-erpnext/erpnext_sync.py”, line 138, in pull_process_and_push_data
raise Exception(‘API Call to ERPNext Failed.’)
Exception: API Call to ERPNext Failed.
2023-03-30 02:42:16,846 ERROR Error during ERPNext API Call. 1 1666863029.0 4th Floor IN Traceback (most recent call last):
File “apps/frappe/frappe/handler.py”, line 72, in execute_cmd
method = get_attr(cmd)
File “apps/frappe/frappe/handler.py”, line 258, in get_attr
method = frappe.get_attr(cmd)
File “apps/frappe/frappe/init.py”, line 1577, in get_attr
return getattr(get_module(modulename), methodname)
File “apps/frappe/frappe/init.py”, line 1319, in get_module
return importlib.import_module(modulename)
File “/usr/lib/python3.10/importlib/init.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1050, in _gcd_import
File “”, line 1027, in _find_and_load
File “”, line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named ‘erpnext.hr.doctype.employee_checkin.employee_checkin’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “apps/frappe/frappe/app.py”, line 69, in application
response = frappe.api.handle()
File “apps/frappe/frappe/api.py”, line 54, in handle
return frappe.handler.handle()
File “apps/frappe/frappe/handler.py”, line 45, in handle
data = execute_cmd(cmd)
File “apps/frappe/frappe/handler.py”, line 74, in execute_cmd
frappe.throw(_(“Failed to get method for command {0} with {1}”).format(cmd, e))
File “apps/frappe/frappe/init.py”, line 522, in throw
msgprint(
File “apps/frappe/frappe/init.py”, line 490, in msgprint
_raise_exception()
File “apps/frappe/frappe/init.py”, line 442, in _raise_exception
raise raise_exception(msg)
frappe.exceptions.ValidationError: Failed to get method for command erpnext.hr.doctype.employee_checkin.employee_checkin.add_log_based_on_employee_field with No module named ‘erpnext.hr.doctype.employee_checkin.employee_checkin’

2023-03-30 02:42:16,847 ERROR exception when calling pull_process_and_push_data function for device{“device_id”: “4th Floor”, “ip”: “192.168.56.31”, “punch_direction”: “AUTO”, “clear_from_device_on_fetch”: false}
Traceback (most recent call last):
File “/home/frappe/myfrappe/sites/push-biometric-erpnext/erpnext_sync.py”, line 60, in main
pull_process_and_push_data(device, device_attendance_logs)
File “/home/frappe/myfrappe/sites/push-biometric-erpnext/erpnext_sync.py”, line 138, in pull_process_and_push_data
raise Exception(‘API Call to ERPNext Failed.’)
Exception: API Call to ERPNext Failed.
2023-03-30 02:42:16,887 ERROR Error during ERPNext API Call. 3812 1668675799.0 3rd Floor IN Traceback (most recent call last):
File “apps/frappe/frappe/handler.py”, line 72, in execute_cmd
method = get_attr(cmd)
File “apps/frappe/frappe/handler.py”, line 258, in get_attr
method = frappe.get_attr(cmd)
File “apps/frappe/frappe/init.py”, line 1577, in get_attr
return getattr(get_module(modulename), methodname)
File “apps/frappe/frappe/init.py”, line 1319, in get_module
return importlib.import_module(modulename)
File “/usr/lib/python3.10/importlib/init.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1050, in _gcd_import
File “”, line 1027, in _find_and_load
File “”, line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named ‘erpnext.hr.doctype.employee_checkin.employee_checkin’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “apps/frappe/frappe/app.py”, line 69, in application
response = frappe.api.handle()
File “apps/frappe/frappe/api.py”, line 54, in handle
return frappe.handler.handle()
File “apps/frappe/frappe/handler.py”, line 45, in handle
data = execute_cmd(cmd)
File “apps/frappe/frappe/handler.py”, line 74, in execute_cmd
frappe.throw(_(“Failed to get method for command {0} with {1}”).format(cmd, e))
File “apps/frappe/frappe/init.py”, line 522, in throw
msgprint(
File “apps/frappe/frappe/init.py”, line 490, in msgprint
_raise_exception()
File “apps/frappe/frappe/init.py”, line 442, in _raise_exception
raise raise_exception(msg)
frappe.exceptions.ValidationError: Failed to get method for command erpnext.hr.doctype.employee_checkin.employee_checkin.add_log_based_on_employee_field with No module named ‘erpnext.hr.doctype.employee_checkin.employee_checkin’

2023-03-30 02:42:16,888 ERROR exception when calling pull_process_and_push_data function for device{“device_id”: “3rd Floor”, “ip”: “192.168.50.17”, “punch_direction”: “AUTO”, “clear_from_device_on_fetch”: false}
Traceback (most recent call last):
File “/home/frappe/myfrappe/sites/push-biometric-erpnext/erpnext_sync.py”, line 60, in main
pull_process_and_push_data(device, device_attendance_logs)
File “/home/frappe/myfrappe/sites/push-biometric-erpnext/erpnext_sync.py”, line 138, in pull_process_and_push_data
raise Exception(‘API Call to ERPNext Failed.’)
Exception: API Call to ERPNext Failed.

What I have done is, I have intentionally changed the API Secret and run the script. It raised the same error. I am confused. I have generated the Secret for Administrator user and that copied and pasted in the script; moreover, to check please also see the screenshot.

Here lies your issue. migrating to version 14 changes that endpoint to ‘hrms.hr.doctype.employee_checkin.employee_checkin’ since HR module is now a separate app.

You need to make sure you have the latest update of the biometric sync tool. Go to the tool directory and git pull if you haven’t done that and you will also need to make a minor change to your local_config.py. Once you pull, change the ERPNext version under the key to 14 (the default will be 13) and then stop and restart the tool to use the new changes.

Hope this helps

Many thanks for pointing me to the right direction. I just changed erpnext to hrms in the erpnext_sync.py file.

I changed from

url = config.ERPNEXT_URL + “/api/method/erpnext.hr.doctype.employee_checkin.employee_checkin.add_log_based_on_employee_field”

to

url = config.ERPNEXT_URL + “/api/method/hrms.hr.doctype.employee_checkin.employee_checkin.add_log_based_on_employee_field”

And it is working fine now.
Many thanks.

I think you should pull the update instead as this guarantees you will have the most updated functions.

I think I am missing something here.
the git has release of 2020, not above that.

is there anything else?

Update: I have manually downloaded the latest files.

Thanks a lot for your perfect video. When I run the file “erpnext_sync.py” as https://youtu.be/KhfncWCcu68?t=277 It shows Service Running" only and didnt show any data behind “Service Dunning” and also without any change at ERPNext.

Thanks a lot for your perfect video. When I run the file “erpnext_sync.py” as https://youtu.be/KhfncWCcu68?t=277 It shows Service Running" only and didnt show any data behind “Service Dunning” and also without any change at ERPNext.

Dear @karthikeyan5,

I hope you are well. And thanks for your information.

Would you please tell me whether it is possible to get the vacation and mission logs in addition to check in/check out via biometric device in erpnext?

Sincerely yours,
Zahra

its the same thing i was looking for

where did u get push_to_erpnext.py file i don’t seem to find it any where

I am using ZKTeco’s ADMS Push Protocol to get realtime data.

@hlimkhaled is that possible device is not ping from server and it gives logs in employee checkin after taking some time?

ADMS is a push protocol, device sends request to the server, the server is not pulling. In this way, you can also send commands to devices in response body.

This documentation will help (translate to your language)
ZKTeco Push Protocol · Nufaza Docs

1 Like