Python Scripts to poll your biometric attendance system (BAS) for logs and sync with your ERPNext instance
There's two ways you can use this tool. If accessing the CLI is a bit of a pain for you, the GUI has a simple form to guide you through the process.
Under /releases, for a particular release download the biometric-attendance-sync-tool-[version]-[distribution].zip
and unzip it's contents. Now from the location of the unzipped files, you can go ahead with the CLI or GUI method.
Run the attendance-sync
file from the folder; This should setup all it's dependencies automatically and start the GUI.
The erpnext_sync.py
file is the "backbone" of this project. Apart from Windows _(which has its own wrapper erpnext_sync_win.py
)_, this file can be directly used to set up the sync tool. Further information provided in the /Wiki.
Setup dependencies
cd biometric-attendance-sync-tool
&& python3 -m venv venv
&& source venv/bin/activate
&& pip install -r requirements.txt
Setup local_config.py
Make a copy of and rename local_config.py.template
file. Learn More
Run this script using python3 erpnext_sync.py
There's a Wiki for this.
Installing as a Windows service
pip install pywin32
python erpnext_sync_win.py install
python erpnext_sync_win.py update
net stop ERPNextBiometricPushService
mmc Services.msc
local_config.py.template
file and rename it to local_config.py
Below are the delineation of the keys contained in local_config.py
:
ERPNext connection configs:
ERPNEXT_API_KEY
: The API Key of the ERPNext User
ERPNEXT_API_SECRET
: The API Secret of the ERPNext User
Please refer to this link to learn how to generate API key and secret for a user in ERPNext. The ERPNext User who's API key and secret is used, needs to have at least the following permissions:
- Create Permissions for 'Employee Checkin' DocType.
- Write Permissions for 'Shift Type' DocType.
ERPNEXT_URL
: The web address at which you would access your ERPNext. eg:'https://yourcompany.erpnext.com'
, 'https://erp.yourcompany.com'
ERPNEXT_VERSION
: The base version of your ERPNext app. eg: 12, 13, 14
This script's operational configs:
PULL_FREQUENCY
: The time in minutes after which a pull for punches from the biometric device and push to ERPNext is attempted again.
LOGS_DIRECTORY
: The Directory in which the logs related to this script's whereabouts are stored.
Hint: For most cases you can leave the above two keys unchanged.
IMPORT_START_DATE
: The date after which the punches are pushed to ERPNext. Expected Format: YYYYMMDD
.
For some cases you would have a lot of old punches in the biometric device. But, you would want to only import punches after certain date. You could set this key appropriately. Also, you can leave this as
None
if this case does not apply to you.
TODO: fill this section with more info to help Non-Technical Individuals.
gui.py
located) by
cd biometric-attendance-sync-tool
Run the following commands:
pip install pyinstaller
python -m PyInstaller --name="attendance-sync" --windowed --onefile gui.py
attendance-sync
created inside dist/
folder.This project is licensed under GNU General Public License v3.0