Skip to content

Commit ef12005

Browse files
committed
OHRMS ZK Attendance
1 parent 87d357e commit ef12005

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2073
-0
lines changed

oh_hr_zk_attendance/README.rst

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
Biometric Device Integration v12
2+
================================
3+
This Cybrosys's module integrates Odoo attendance with biometric device attendance.
4+
5+
Features
6+
========
7+
* Integrates biometric device(Face+Thumb) with HR attendance.
8+
* Managing attendance automatically
9+
* Keeps zk machine history in Odoo
10+
* Option to configure multiple zk devices
11+
* Option to clear all zk history from both device and Odoo
12+
13+
Technical Notes
14+
===============
15+
Used Libraries:
16+
17+
*This integration is only applicable for the the device ZKteco model 'uFace 202' & 'iFace990'
18+
* zklib
19+
you can install zklib library using "sudo pip install zklib"
20+
21+
Compatible Devices
22+
23+
*ZKteco model 'uFace 202'
24+
*ZKteco model 'iFace990'
25+
26+
Author
27+
=======
28+
* Cybrosys Techno Solutions <https://www.cybrosys.com>
29+
30+
Credits
31+
=======
32+
Developer: Niyas Raphy @ Cybrosys, [email protected] V11
33+
Developer: Jesni Banu @ cybrosys, [email protected] V10
34+
Developer: Basith @ Cybrosys, [email protected] V12
35+
Developer: Mostafa Shokiel , [email protected]
36+

oh_hr_zk_attendance/__init__.py

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# -*- coding: utf-8 -*-
2+
###################################################################################
3+
#
4+
# Cybrosys Technologies Pvt. Ltd.
5+
# Copyright (C) 2018-TODAY Cybrosys Technologies(<http://www.cybrosys.com>).
6+
# Author: cybrosys(<https://www.cybrosys.com>)
7+
#
8+
# This program is free software: you can modify
9+
# it under the terms of the GNU Affero General Public License (AGPL) as
10+
# published by the Free Software Foundation, either version 3 of the
11+
# License, or (at your option) any later version.
12+
#
13+
# This program is distributed in the hope that it will be useful,
14+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
# GNU Affero General Public License for more details.
17+
#
18+
# You should have received a copy of the GNU Affero General Public License
19+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
20+
#
21+
###################################################################################
22+
from . import models

oh_hr_zk_attendance/__manifest__.py

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# -*- coding: utf-8 -*-
2+
###################################################################################
3+
#
4+
# Cybrosys Technologies Pvt. Ltd.
5+
# Copyright (C) 2018-TODAY Cybrosys Technologies(<http://www.cybrosys.com>).
6+
# Author: cybrosys(<https://www.cybrosys.com>)
7+
#
8+
# This program is free software: you can modify
9+
# it under the terms of the GNU Affero General Public License (AGPL) as
10+
# published by the Free Software Foundation, either version 3 of the
11+
# License, or (at your option) any later version.
12+
#
13+
# This program is distributed in the hope that it will be useful,
14+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
# GNU Affero General Public License for more details.
17+
#
18+
# You should have received a copy of the GNU Affero General Public License
19+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
20+
#
21+
###################################################################################
22+
{
23+
'name': 'Open HRMS Biometric Device Integration',
24+
'version': '12.0.1.0.0',
25+
'summary': """Integrating Biometric Device With HR Attendance (Face + Thumb)""",
26+
'description': 'This module integrates Odoo with the biometric device(Model: ZKteco uFace 202)',
27+
'category': 'Generic Modules/Human Resources',
28+
'author': 'Cybrosys Techno Solutions, Mostafa Shokiel',
29+
'company': 'Cybrosys Techno Solutions',
30+
'website': "http://www.cybrosys.com",
31+
'depends': ['base_setup', 'hr_attendance'],
32+
'data': [
33+
'security/ir.model.access.csv',
34+
'views/zk_machine_view.xml',
35+
'views/zk_machine_attendance_view.xml',
36+
'data/download_data.xml'
37+
38+
],
39+
'images': ['static/description/banner.jpg'],
40+
'license': 'AGPL-3',
41+
'demo': [],
42+
'installable': True,
43+
'auto_install': False,
44+
'application': False,
45+
}
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0"?>
2+
<odoo noupdate="1">
3+
<record forcecreate="True" id="cron_download_data" model="ir.cron">
4+
<field name="name">Download Data</field>
5+
<field eval="True" name="active" />
6+
<field name="user_id" ref="base.user_root" />
7+
<field name="interval_number">10</field>
8+
<field name="interval_type">minutes</field>
9+
<field name="numbercall">-1</field>
10+
11+
<field name="model_id" ref="oh_hr_zk_attendance.model_zk_machine" />
12+
<field name="state">code</field>
13+
<field name="code">model.cron_download()</field>
14+
</record>
15+
</odoo>
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# -*- coding: utf-8 -*-
2+
###################################################################################
3+
#
4+
# Cybrosys Technologies Pvt. Ltd.
5+
# Copyright (C) 2018-TODAY Cybrosys Technologies(<http://www.cybrosys.com>).
6+
# Author: cybrosys(<https://www.cybrosys.com>)
7+
#
8+
# This program is free software: you can modify
9+
# it under the terms of the GNU Affero General Public License (AGPL) as
10+
# published by the Free Software Foundation, either version 3 of the
11+
# License, or (at your option) any later version.
12+
#
13+
# This program is distributed in the hope that it will be useful,
14+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
# GNU Affero General Public License for more details.
17+
#
18+
# You should have received a copy of the GNU Affero General Public License
19+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
20+
#
21+
###################################################################################
22+
from . import zk_machine
23+
from . import machine_analysis
24+
from . import zklib
25+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# -*- coding: utf-8 -*-
2+
###################################################################################
3+
#
4+
# Cybrosys Technologies Pvt. Ltd.
5+
# Copyright (C) 2018-TODAY Cybrosys Technologies(<http://www.cybrosys.com>).
6+
# Author: cybrosys(<https://www.cybrosys.com>)
7+
#
8+
# This program is free software: you can modify
9+
# it under the terms of the GNU Affero General Public License (AGPL) as
10+
# published by the Free Software Foundation, either version 3 of the
11+
# License, or (at your option) any later version.
12+
#
13+
# This program is distributed in the hope that it will be useful,
14+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
# GNU Affero General Public License for more details.
17+
#
18+
# You should have received a copy of the GNU Affero General Public License
19+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
20+
#
21+
###################################################################################
22+
from odoo import tools
23+
from odoo import models, fields, api, _
24+
25+
26+
class HrEmployee(models.Model):
27+
_inherit = 'hr.employee'
28+
29+
device_id = fields.Char(string='Biometric Device ID')
30+
31+
32+
class ZkMachine(models.Model):
33+
_name = 'zk.machine.attendance'
34+
_inherit = 'hr.attendance'
35+
36+
@api.constrains('check_in', 'check_out', 'employee_id')
37+
def _check_validity(self):
38+
"""overriding the __check_validity function for employee attendance."""
39+
pass
40+
41+
device_id = fields.Char(string='Biometric Device ID')
42+
punch_type = fields.Selection([('0', 'Check In'),
43+
('1', 'Check Out'),
44+
('2', 'Break Out'),
45+
('3', 'Break In'),
46+
('4', 'Overtime In'),
47+
('5', 'Overtime Out')],
48+
string='Punching Type')
49+
50+
attendance_type = fields.Selection([('1', 'Finger'),
51+
('15', 'Face'),
52+
('2','Type_2'),
53+
('3','Password'),
54+
('4','Card')], string='Category')
55+
punching_time = fields.Datetime(string='Punching Time')
56+
address_id = fields.Many2one('res.partner', string='Working Address')
57+
58+
59+
class ReportZkDevice(models.Model):
60+
_name = 'zk.report.daily.attendance'
61+
_auto = False
62+
_order = 'punching_day desc'
63+
64+
name = fields.Many2one('hr.employee', string='Employee')
65+
punching_day = fields.Datetime(string='Date')
66+
address_id = fields.Many2one('res.partner', string='Working Address')
67+
attendance_type = fields.Selection([('1', 'Finger'),
68+
('15', 'Face'),
69+
('2','Type_2'),
70+
('3','Password'),
71+
('4','Card')],
72+
string='Category')
73+
punch_type = fields.Selection([('0', 'Check In'),
74+
('1', 'Check Out'),
75+
('2', 'Break Out'),
76+
('3', 'Break In'),
77+
('4', 'Overtime In'),
78+
('5', 'Overtime Out')], string='Punching Type')
79+
punching_time = fields.Datetime(string='Punching Time')
80+
81+
def init(self):
82+
tools.drop_view_if_exists(self._cr, 'zk_report_daily_attendance')
83+
query = """
84+
create or replace view zk_report_daily_attendance as (
85+
select
86+
min(z.id) as id,
87+
z.employee_id as name,
88+
z.write_date as punching_day,
89+
z.address_id as address_id,
90+
z.attendance_type as attendance_type,
91+
z.punching_time as punching_time,
92+
z.punch_type as punch_type
93+
from zk_machine_attendance z
94+
join hr_employee e on (z.employee_id=e.id)
95+
GROUP BY
96+
z.employee_id,
97+
z.write_date,
98+
z.address_id,
99+
z.attendance_type,
100+
z.punch_type,
101+
z.punching_time
102+
)
103+
"""
104+
self._cr.execute(query)
105+
106+

0 commit comments

Comments
 (0)