Browse Source

Aug 05: [FIX] Bug Fixed 'hr_zk_attendance'

pull/331/head
Cybrosys Technologies 9 months ago
parent
commit
1a8622fc80
  1. 2
      hr_zk_attendance/__init__.py
  2. 4
      hr_zk_attendance/__manifest__.py
  3. 6
      hr_zk_attendance/doc/RELEASE_NOTES.md
  4. 2
      hr_zk_attendance/models/__init__.py
  5. 38
      hr_zk_attendance/models/biometric_device_details.py
  6. 2
      hr_zk_attendance/models/daily_attendance.py
  7. 2
      hr_zk_attendance/models/hr_employee.py
  8. 2
      hr_zk_attendance/models/zk_machine_attendance.py
  9. BIN
      hr_zk_attendance/static/description/assets/screenshots/img7.png
  10. 94
      hr_zk_attendance/static/description/index.html
  11. 2
      hr_zk_attendance/views/biometric_device_details_views.xml

2
hr_zk_attendance/__init__.py

@ -3,7 +3,7 @@
# #
# Cybrosys Technologies Pvt. Ltd. # Cybrosys Technologies Pvt. Ltd.
# #
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). # Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Ammu Raj (odoo@cybrosys.com) # Author: Ammu Raj (odoo@cybrosys.com)
# #
# You can modify it under the terms of the GNU AFFERO # You can modify it under the terms of the GNU AFFERO

4
hr_zk_attendance/__manifest__.py

@ -3,7 +3,7 @@
# #
# Cybrosys Technologies Pvt. Ltd. # Cybrosys Technologies Pvt. Ltd.
# #
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). # Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Ammu Raj (odoo@cybrosys.com) # Author: Ammu Raj (odoo@cybrosys.com)
# #
# You can modify it under the terms of the GNU AFFERO # You can modify it under the terms of the GNU AFFERO
@ -21,7 +21,7 @@
################################################################################ ################################################################################
{ {
'name': 'Biometric Device Integration', 'name': 'Biometric Device Integration',
'version': '17.0.1.0.0', 'version': '17.0.1.1.1',
'category': 'Human Resources', 'category': 'Human Resources',
'summary': "Integrating Biometric Device (Model: ZKteco uFace 202) With HR" 'summary': "Integrating Biometric Device (Model: ZKteco uFace 202) With HR"
"Attendance (Face + Thumb)", "Attendance (Face + Thumb)",

6
hr_zk_attendance/doc/RELEASE_NOTES.md

@ -5,3 +5,9 @@
##### ADD ##### ADD
- Initial commit for Biometric Device Integration - Initial commit for Biometric Device Integration
#### 31.07.2024
#### Version 17.0.1.1.1
##### UPDT
- Added a new feature to Set the timezone for the device.

2
hr_zk_attendance/models/__init__.py

@ -3,7 +3,7 @@
# #
# Cybrosys Technologies Pvt. Ltd. # Cybrosys Technologies Pvt. Ltd.
# #
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). # Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Ammu Raj (odoo@cybrosys.com) # Author: Ammu Raj (odoo@cybrosys.com)
# #
# You can modify it under the terms of the GNU AFFERO # You can modify it under the terms of the GNU AFFERO

38
hr_zk_attendance/models/biometric_device_details.py

@ -3,7 +3,7 @@
# #
# Cybrosys Technologies Pvt. Ltd. # Cybrosys Technologies Pvt. Ltd.
# #
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). # Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Ammu Raj (odoo@cybrosys.com) # Author: Ammu Raj (odoo@cybrosys.com)
# #
# You can modify it under the terms of the GNU AFFERO # You can modify it under the terms of the GNU AFFERO
@ -74,6 +74,41 @@ class BiometricDeviceDetails(models.Model):
} }
except Exception as error: except Exception as error:
raise ValidationError(f'{error}') raise ValidationError(f'{error}')
def action_set_timezone(self):
"""Function to set user's timezone to device"""
for info in self:
machine_ip = info.device_ip
zk_port = info.port_number
try:
# Connecting with the device with the ip and port provided
zk = ZK(machine_ip, port=zk_port, timeout=15,
password=0,
force_udp=False, ommit_ping=False)
except NameError:
raise UserError(
_("Pyzk module not Found. Please install it"
"with 'pip3 install pyzk'."))
conn = self.device_connect(zk)
if conn:
user_tz = self.env.context.get(
'tz') or self.env.user.tz or 'UTC'
user_timezone_time = pytz.utc.localize(fields.Datetime.now())
user_timezone_time = user_timezone_time.astimezone(
pytz.timezone(user_tz))
conn.set_time(user_timezone_time)
return {
'type': 'ir.actions.client',
'tag': 'display_notification',
'params': {
'message': 'Successfully Set the Time',
'type': 'success',
'sticky': False
}
}
else:
raise UserError(_(
"Please Check the Connection"))
def action_clear_attendance(self): def action_clear_attendance(self):
"""Methode to clear record from the zk.machine.attendance model and """Methode to clear record from the zk.machine.attendance model and
@ -129,6 +164,7 @@ class BiometricDeviceDetails(models.Model):
_("Pyzk module not Found. Please install it" _("Pyzk module not Found. Please install it"
"with 'pip3 install pyzk'.")) "with 'pip3 install pyzk'."))
conn = self.device_connect(zk) conn = self.device_connect(zk)
self.action_set_timezone()
if conn: if conn:
conn.disable_device() # Device Cannot be used during this time. conn.disable_device() # Device Cannot be used during this time.
user = conn.get_users() user = conn.get_users()

2
hr_zk_attendance/models/daily_attendance.py

@ -3,7 +3,7 @@
# #
# Cybrosys Technologies Pvt. Ltd. # Cybrosys Technologies Pvt. Ltd.
# #
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). # Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Ammu Raj (odoo@cybrosys.com) # Author: Ammu Raj (odoo@cybrosys.com)
# #
# You can modify it under the terms of the GNU AFFERO # You can modify it under the terms of the GNU AFFERO

2
hr_zk_attendance/models/hr_employee.py

@ -3,7 +3,7 @@
# #
# Cybrosys Technologies Pvt. Ltd. # Cybrosys Technologies Pvt. Ltd.
# #
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). # Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Ammu Raj (odoo@cybrosys.com) # Author: Ammu Raj (odoo@cybrosys.com)
# #
# You can modify it under the terms of the GNU AFFERO # You can modify it under the terms of the GNU AFFERO

2
hr_zk_attendance/models/zk_machine_attendance.py

@ -3,7 +3,7 @@
# #
# Cybrosys Technologies Pvt. Ltd. # Cybrosys Technologies Pvt. Ltd.
# #
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). # Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Ammu Raj (odoo@cybrosys.com) # Author: Ammu Raj (odoo@cybrosys.com)
# #
# You can modify it under the terms of the GNU AFFERO # You can modify it under the terms of the GNU AFFERO

BIN
hr_zk_attendance/static/description/assets/screenshots/img7.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

94
hr_zk_attendance/static/description/index.html

@ -158,10 +158,8 @@
</div> </div>
<div> <div>
<p style="color: #1A202C;font-weight: 600; <p style="color: #1A202C;font-weight: 600;
font-size: 1.2rem; margin-bottom: 2px;">HR font-size: 1.2rem; margin-bottom: 2px;">Restart and set Time of Device.</p>
Attendance.</p> <p class="m-0" style="color:#718096">We can set the timezone of the device and also restart the device.
<p class="m-0" style="color:#718096">Automates HR
Attendance.
</p> </p>
</div> </div>
</div> </div>
@ -180,10 +178,12 @@
<p style="color: #1A202C;font-weight: 600; <p style="color: #1A202C;font-weight: 600;
font-size: 1.2rem; margin-bottom: 2px;"> font-size: 1.2rem; margin-bottom: 2px;">
Supporting Models</p> Supporting Models</p>
<p class="m-0" style="color:#718096">This module support with the following machines :<br> <p class="m-0" style="color:#718096">This module
support with the following machines :<br>
* uFace202 (ZKteco)<br> * uFace202 (ZKteco)<br>
* iFace990 (ZKteco)<br> * iFace990 (ZKteco)<br>
-Clients have reported that the module works well with the following machine :<br> -Clients have reported that the module works
well with the following machine :<br>
* K40 Pro (ZKteco)<br> * K40 Pro (ZKteco)<br>
* SFace900 (ZKteco)<br> * SFace900 (ZKteco)<br>
* FR1500 (ZKteco)<br> * FR1500 (ZKteco)<br>
@ -315,6 +315,23 @@
</div> </div>
</div> </div>
</div> </div>
<div class="col-lg-12 py-2"
style="padding: 1rem 4rem !important;">
<div
style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/img7.png"
class="img-responsive" width="100%"
height="auto">
</div>
<div class="px-3">
<h4 class="mt-2"
style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important">
Here you can set the Time zone for Device .
</h4>
</div>
</div>
</div>
<div class="col-lg-12 py-2" <div class="col-lg-12 py-2"
style="padding: 1rem 4rem !important;"> style="padding: 1rem 4rem !important;">
<div <div
@ -350,6 +367,15 @@
automatically create corresponding automatically create corresponding
employee.</h4> employee.</h4>
</div> </div>
<div class="col-lg-12 my-2">
<div class="alert alert-info" role="alert">
Note:- This integration is only applicable
for the Device ZKteco model 'uFace 202'
Please install
zklib
library (sudo pip install zklib)
</div>
</div>
</div> </div>
</div> </div>
<div class="col-lg-12 py-2" <div class="col-lg-12 py-2"
@ -364,33 +390,33 @@
<span style="margin-right: 12px;"><img <span style="margin-right: 12px;"><img
src="assets/misc/star (1) 2.svg" src="assets/misc/star (1) 2.svg"
alt="" alt=""
width="16px"></span>Can choose width="16px"></span>Can Download
Employee from Work Order itself. Attendance
</li> </li>
<li class="py-3" <li class="py-3"
style="font-weight: 500;background-color: #fff; border-radius: 4px; padding: 1rem; margin-bottom: 1rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);"> style="font-weight: 500;background-color: #fff; border-radius: 4px; padding: 1rem; margin-bottom: 1rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<span style="margin-right: 12px;"><img <span style="margin-right: 12px;"><img
src="assets/misc/star (1) 2.svg" src="assets/misc/star (1) 2.svg"
alt="" alt=""
width="16px"></span>Using Project width="16px"></span>Clear Attendance
and Tasks makes it easier.
</li> </li>
<li class="py-3" <li class="py-3"
style="font-weight: 500;background-color: #fff; border-radius: 4px; padding: 1rem; margin-bottom: 1rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);"> style="font-weight: 500;background-color: #fff; border-radius: 4px; padding: 1rem; margin-bottom: 1rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<span style="margin-right: 12px;"><img <span style="margin-right: 12px;"><img
src="assets/misc/star (1) 2.svg" src="assets/misc/star (1) 2.svg"
alt="" alt=""
width="16px"></span>Timesheet for width="16px"></span>Can Restart
Manufacturing. Device from odoo
<ul style="list-style: none;font-weight: 400; color:#718096">
<li>A Project will be created in the name of </li>
Manufacturing Order , <li class="py-3"
and Task will be created in the name of style="font-weight: 500;background-color: #fff; border-radius: 4px; padding: 1rem; margin-bottom: 1rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
Work Order. The Time <span style="margin-right: 12px;"><img
tracking of the Work Order will be added src="assets/misc/star (1) 2.svg"
as Timesheet. alt=""
</li> width="16px"></span>Can set timezone
</ul> of Device.
</li> </li>
</ul> </ul>
@ -402,15 +428,31 @@
style="font-weight: 500;background-color: #fff; border-radius: 4px; padding: 1rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);"> style="font-weight: 500;background-color: #fff; border-radius: 4px; padding: 1rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="d-flex mb-3" <div class="d-flex mb-3"
style="font-size: 0.8rem; font-weight: 500;"><span>Version style="font-size: 0.8rem; font-weight: 500;"><span>Version
16.0.1.0.0</span><span 17.0.1.0.0</span><span
class="px-2">|</span><span
style="color: #714B67;font-weight: 600;">Released on:16th November 2023</span>
</div>
<p class="m-0"
style=" color:#718096!important; font-size:1rem !important;line-height: 28px;">
Initial Commit for Biometric Device
Integration.</p>
</div>
</div>
<div class="col-mg-12 active" style="padding: 1rem 4rem;">
<div class="py-3"
style="font-weight: 500;background-color: #fff; border-radius: 4px; padding: 1rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="d-flex mb-3"
style="font-size: 0.8rem; font-weight: 500;"><span>Version
17.0.1.0.0</span><span
class="px-2">|</span><span class="px-2">|</span><span
style="color: #714B67;font-weight: 600;">Released on:25th May 2023</span> style="color: #714B67;font-weight: 600;">Released on:31st July 2024</span>
</div> </div>
<p class="m-0" <p class="m-0"
style=" color:#718096!important; font-size:1rem !important;line-height: 28px;"> style=" color:#718096!important; font-size:1rem !important;line-height: 28px;">
Initial Commit for Manufacturing (MRP) Added a feature to set the time in Biometric
Timesheet.</p> Device Integration.</p>
</div> </div>
</div> </div>
</div> </div>
@ -527,7 +569,7 @@
height="auto"> height="auto">
</div> </div>
<p class="text-center pt-2 text-black font-weight-bold"> <p class="text-center pt-2 text-black font-weight-bold">
UPCITEMDB Integration</p> UPCITEMDB Integration</p>
</div> </div>
</a> </a>
</div> </div>

2
hr_zk_attendance/views/biometric_device_details_views.xml

@ -19,6 +19,8 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<form> <form>
<header> <header>
<button name="action_set_timezone" string=" Set Time"
type="object" class="oe_highlight"/>
<button name="action_download_attendance" <button name="action_download_attendance"
string="Download Data" string="Download Data"
type="object" class="oe_highlight"/> type="object" class="oe_highlight"/>

Loading…
Cancel
Save