-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] hr_attendance_resume_anomaly: This module performs anomaly cont…
…rol in the attendances summary.
- Loading branch information
1 parent
a502938
commit 8a73f97
Showing
18 changed files
with
1,092 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
|
||
============================ | ||
Hr attendance resume anomaly | ||
============================ | ||
|
||
* This module performs anomaly control in the attendances summary. These are | ||
the anomalies that are controlled: | ||
|
||
- "There are attendances in day that do not apply". No turn or has | ||
vacationed. | ||
- "Have absence". The worker has worked, and has absent. | ||
- "Festive worked". The worker has worked on festive day. | ||
- "There is an approved absence and there is no attendance". The worker has | ||
not imputed, and is absent. | ||
- "Entry without exit". The worker forgot to impute in at the exit. | ||
- "Attendances very often". Imputations very often, less than 1 minute. | ||
- "There is no attendance in day that corresponds". The worker should to have | ||
imputed on this day, and has not done so. | ||
- "Real working day greater or less than the percentage over the planned day" | ||
Actual day greater or lesser than the percentage of expected day | ||
(provided there are no approved absences). The percentages are defined in | ||
the calendar, one for excess, and another defect. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues | ||
<https://github.com/avanzosc/hr-addons/issues>`_. In case of trouble, please | ||
check there if your issue has already been reported. If you spotted it first, | ||
help us smash it by providing detailed and welcomed feedback. | ||
|
||
Credits | ||
======= | ||
|
||
Contributors | ||
------------ | ||
* Ana Juaristi <[email protected]> | ||
* Alfredo de la Fuente <[email protected]> | ||
|
||
Do not contact contributors directly about support or help with technical issues. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Copyright 2019 Alfredo de la Fuente - AvanzOSC | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
from . import models | ||
from . import wizard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright 2019 Alfredo de la Fuente - AvanzOSC | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
{ | ||
"name": "Hr Attendance Resume Anomaly", | ||
"version": "12.0.1.0.0", | ||
"license": "AGPL-3", | ||
"depends": [ | ||
"hr_attendance_control", | ||
"hr_attendance_resume_holidays", | ||
"hr_attendance_resume_absences" | ||
], | ||
"author": "AvanzOSC", | ||
"website": "http://www.avanzosc.es", | ||
"category": "Human Resources", | ||
"data": [ | ||
"security/ir.model.access.csv", | ||
"data/hr_attendance_resume_anomaly_data.xml", | ||
"wizard/wiz_attendance_resume_put_resolved_view.xml", | ||
"views/hr_attendance_resume_view.xml", | ||
"views/resource_calendar_view.xml", | ||
], | ||
"installable": True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Copyright 2019 Alfredo de la Fuente - AvanzOSC | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
from datetime import date as datetype | ||
from dateutil.relativedelta import relativedelta | ||
from pytz import timezone, utc | ||
from odoo import fields, _ | ||
|
||
str2datetime = fields.Datetime.from_string | ||
date2str = fields.Date.to_string | ||
|
||
|
||
def _convert_to_local_date(date, tz=u'UTC'): | ||
if not date: | ||
return False | ||
if not tz: | ||
tz = u'UTC' | ||
new_date = str2datetime(date) if isinstance(date, str) else date | ||
new_date = new_date.replace(tzinfo=utc) | ||
local_date = new_date.astimezone(timezone(tz)).replace(tzinfo=None) | ||
return local_date | ||
|
||
|
||
def _convert_to_utc_date(date, time=0.0, tz=u'UTC'): | ||
if not date: | ||
return False | ||
if not tz: | ||
tz = u'UTC' | ||
date = date2str(date) if isinstance(date, datetype) else date | ||
date = str2datetime(date) if isinstance(date, str) else date | ||
date += relativedelta(hours=float(time)) | ||
local = timezone(tz) | ||
local_date = local.localize(date, is_dst=None) | ||
utc_date = local_date.astimezone(utc).replace(tzinfo=None) | ||
return utc_date | ||
|
||
|
||
def _convert_time_to_float(date, tz=u'UTC'): | ||
if not date: | ||
return False | ||
if not tz: | ||
tz = u'UTC' | ||
local_time = _convert_to_local_date(date, tz=tz) | ||
hour = float(local_time.hour) | ||
minutes = float(local_time.minute) / 60 | ||
seconds = float(local_time.second) / 360 | ||
return (hour + minutes + seconds) | ||
|
||
|
||
def _catch_dayofweek(date): | ||
day = str(date.weekday()) | ||
if day == '0': | ||
return _('Monday') | ||
if day == '1': | ||
return _('Tuesday') | ||
if day == '2': | ||
return _('Wednesday') | ||
if day == '3': | ||
return _('Thursday') | ||
if day == '4': | ||
return _('Friday') | ||
if day == '5': | ||
return _('Saturday') | ||
if day == '6': | ||
return _('Sunday') |
30 changes: 30 additions & 0 deletions
30
hr_attendance_resume_anomaly/data/hr_attendance_resume_anomaly_data.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo noupdate="1"> | ||
<record id="hr_attendance_anomaly_without_calendar_day" model="hr.attendance.resume.anomaly"> | ||
<field name="name">There are attendances in day that do not apply</field> | ||
</record> | ||
<record id="hr_attendance_anomaly_with_leave" model="hr.attendance.resume.anomaly"> | ||
<field name="name">Have absence</field> | ||
</record> | ||
<record id="hr_attendance_anomaly_festive_worked" model="hr.attendance.resume.anomaly"> | ||
<field name="name">Festive worked</field> | ||
</record> | ||
<record id="hr_attendance_anomaly_with_approved_absence" model="hr.attendance.resume.anomaly"> | ||
<field name="name">There is an approved absence and there is no attendance</field> | ||
</record> | ||
<record id="hr_attendance_anomaly_entry_without_exit" model="hr.attendance.resume.anomaly"> | ||
<field name="name">Entry without exit</field> | ||
</record> | ||
<record id="hr_attendance_anomaly_entry_very_often" model="hr.attendance.resume.anomaly"> | ||
<field name="name">Attendances very often</field> | ||
</record> | ||
<record id="hr_attendance_anomaly_entry_no_attendance" model="hr.attendance.resume.anomaly"> | ||
<field name="name">There is no attendance in day that corresponds</field> | ||
</record> | ||
<record id="hr_attendance_anomaly_entry_percentage_day" model="hr.attendance.resume.anomaly"> | ||
<field name="name">Real working day greater or less than the percentage over the planned day</field> | ||
</record> | ||
<record id="hr_attendance_anomaly_negative_time" model="hr.attendance.resume.anomaly"> | ||
<field name="name">Negative imputable time</field> | ||
</record> | ||
</odoo> |
Oops, something went wrong.