Browse Source

[UPDT] Bug fixed 'hr_zk_attendance'

pull/200/head
Ajmal Cybro 3 years ago
parent
commit
3ebb83f3da
  1. 2
      hr_zk_attendance/__manifest__.py
  2. 9
      hr_zk_attendance/models/zk_machine.py

2
hr_zk_attendance/__manifest__.py

@ -21,7 +21,7 @@
###################################################################################
{
'name': 'Biometric Device Integration',
'version': '14.0.1.0.0',
'version': '14.0.1.0.1',
'summary': """Integrating Biometric Device (Model: ZKteco uFace 202) With HR Attendance (Face + Thumb)""",
'description': """This module integrates Odoo with the biometric device(Model: ZKteco uFace 202),odoo13,odd,hr,attendance""",
'category': 'Generic Modules/Human Resources',

9
hr_zk_attendance/models/zk_machine.py

@ -31,6 +31,7 @@ from struct import unpack
from odoo import api, fields, models
from odoo import _
from odoo.exceptions import UserError, ValidationError
_logger = logging.getLogger(__name__)
try:
from zk import ZK, const
@ -114,7 +115,7 @@ class ZkMachine(models.Model):
@api.model
def cron_download(self):
machines = self.env['zk.machine'].search([])
for machine in machines :
for machine in machines:
machine.download_attendance()
def download_attendance(self):
@ -156,7 +157,7 @@ class ZkMachine(models.Model):
for uid in user:
if uid.user_id == each.user_id:
get_user_id = self.env['hr.employee'].search(
[('device_id', '=', each.user_id)])
[('device_id', '=', each.user_id)], limit=1)
if get_user_id:
duplicate_atten_ids = zk_attendance.search(
[('device_id', '=', each.user_id), ('punching_time', '=', atten_time)])
@ -172,11 +173,11 @@ class ZkMachine(models.Model):
att_var = att_obj.search([('employee_id', '=', get_user_id.id),
('check_out', '=', False)])
print('ddfcd', str(each.status))
if each.punch == 0: #check-in
if each.punch == 0: # check-in
if not att_var:
att_obj.create({'employee_id': get_user_id.id,
'check_in': atten_time})
if each.punch == 1: #check-out
if each.punch == 1: # check-out
if len(att_var) == 1:
att_var.write({'check_out': atten_time})
else:

Loading…
Cancel
Save