Connection ZKTeco with ERPNext

My successful setup connect ZKTeco with ERPnext V12 Ubuntu 18.04.4

  1. this link i used to install erpnext V12 ubuntu 18.04.4 ubuntu How to install erpnext version 12 on ubuntu 18.04 - #60 by ssemotom
  2. Clone this repository using - cd frappe-bench then git clone GitHub - frappe/biometric-attendance-sync-tool: A simple tool for syncing Biometric Attendance data with your ERPNext server
  3. sudo apt-get install python3-venv
  4. sudo -H pip install -r requirements.txt
  5. cd push-biometric-erpnext then run sudo nano local_config.py.template
  6. generate api secret : profile → my seting → API ACCESS → generate key
  7. Save API Secret: 4aart49c1efhb47 - then refresh page open api access copy api key : fe14cdc19ed92tg
  8. edit local_ sudo nano config.py.template
# ERPNext related configs 
ERPNEXT_API_KEY = 'fe14cdc19ed92tg' 
ERPNEXT_API_SECRET = '4aart49c1efhb47' 
ERPNEXT_URL = 'http://10.0.0.110' 
# operational configs 
PULL_FREQUENCY = 1 # in minutes  # for testing,  i suggest set it 1 min. then if working set it back to 10  to 20 min
LOGS_DIRECTORY = 'logs' # logs of this script is stored in this directory 
IMPORT_START_DATE = None # format: '20190501' 
# Biometric device configs (all keys mandatory) 
    #- device_id - must be unique, strictly alphanumerical chars only. no space allowed. 
    #- ip - device IP Address 
    #- punch_direction - 'IN'/'OUT'/'AUTO'/None 
    #- clear_from_device_on_fetch: if set to true then attendance is deleted after fetch is success$ 
                                    #(Caution: this feature can lead to data loss if used carelessl$ 
devices = [ 
    {'device_id':'iface7','ip':'10.0.0.96', 'punch_direction': 'AUTO', 'clear_from_device_on_fetch': False}, 
#device id :  name it what ever name you want, ip same ip you set on device , punch derection set to AUTO 
#    {'device_id':'test_2','ip':'192.168.2.209', 'punch_direction': None, 'clear_from_device_on_fetc$ 
] 
# Configs updating sync timestamp in the Shift Type DocType 
shift_type_device_mapping = [ 
    {'shift_type_name': ['Shift1','shift2'], 'related_device_id': ['iface7']} 
#shift name must be same on erpnext, in my case shift have 2 type
]

then "ctrl O " save as local_config.py
10. create employee list same as your device has :
- eg: in erpnext has list 2 employee, you device should have 2 employee register
11. set employee ID same as device :
- human-resource > employee > Employee name > Attendance Device ID (Biometric/RF tag ID). in my case employee 1 id is 1 so device for employee 1 is 1, employee 2 id is 2… and so on .Both id must be same between erpnext and device.
12. create shift type : related link about shift : Shift Management
- employee > Shift Management > Shift types
- shift name must same as local_config.py . in my case shift1 and shift2 in my case 2 different shift periods time
- tick Enable Auto Attendance
- Auto auto attendance setting :
Determine Check-in and Check-out -->>>>> Alternating entries as IN and OUT during the same shift
Working Hours Calculation Based On -->>>> Every Valid Check-in and Check-out
- set Process Attendance After date —> set today. this will set auto calculate attendance when shift is done on that day.
- then click mark auto attendance .
13. Run this script using python3 push_to_erpnext.py
14. check error log if accrue
- tail -f /frappe-bench/push-biometric-erpnext/logs/error.log
15. try check punch in on device then check employee check in at
- Human Resources > Employee Checkin
16. then if everything is working then set “PULL_FREQUENCY = 1” to 10 minute