Skip to content

Commit 641c726

Browse files
[ADD] hr_attendance_resumen: New object hr attendance resume.
1 parent a9abc71 commit 641c726

19 files changed

Lines changed: 1564 additions & 0 deletions

hr_attendance_resume/README.rst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
2+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
3+
:alt: License: AGPL-3
4+
5+
====================
6+
Hr attendance resume
7+
====================
8+
9+
* New object "Hours imputations resume". The new menu option for this object is
10+
found in Attendances - Manage attendances - Imputations resume. To see this
11+
new menu option, the user must be in the group "Attendance-Manager".
12+
* In attendances new wizard for impute then in assistances resume.
13+
14+
Bug Tracker
15+
===========
16+
17+
Bugs are tracked on `GitHub Issues
18+
<https://github.com/avanzosc/hr-addons/issues>`_. In case of trouble, please
19+
check there if your issue has already been reported. If you spotted it first,
20+
help us smash it by providing detailed and welcomed feedback.
21+
22+
Credits
23+
=======
24+
25+
Contributors
26+
------------
27+
* Ana Juaristi <anajuaristi@avanzosc.es>
28+
* Alfredo de la Fuente <alfredodelafuente@avanzosc.es>
29+
30+
Do not contact contributors directly about support or help with technical issues.

hr_attendance_resume/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright 2019 Alfredo de la Fuente - AvanzOSC
2+
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
3+
from . import models
4+
from . import wizard
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright 2019 Alfredo de la Fuente - AvanzOSC
2+
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
3+
{
4+
"name": "Hr Attendance Resume",
5+
"version": "12.0.1.0.0",
6+
"license": "AGPL-3",
7+
"depends": [
8+
"hr_attendance",
9+
"resource_time",
10+
"resource_rest_time",
11+
"resource_bonus",
12+
"hr_employee_calendar_planning"
13+
],
14+
"author": "AvanzOSC",
15+
"website": "http://www.avanzosc.es",
16+
"category": "Human Resources",
17+
"data": [
18+
"security/ir.model.access.csv",
19+
"views/hr_attendance_view.xml",
20+
"views/hr_attendance_resume_view.xml",
21+
"views/hr_employee_view.xml",
22+
"wizard/wiz_hr_attendance_resume_view.xml",
23+
"wizard/wiz_hr_attendance_uncheck_treaties_view.xml",
24+
],
25+
"installable": True,
26+
}

hr_attendance_resume/_common.py

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Copyright 2019 Alfredo de la Fuente - AvanzOSC
2+
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
3+
from datetime import date as datetype
4+
from dateutil.relativedelta import relativedelta
5+
from pytz import timezone, utc
6+
from odoo import fields, _
7+
8+
str2datetime = fields.Datetime.from_string
9+
date2str = fields.Date.to_string
10+
11+
12+
def _convert_to_local_date(date, tz=u'UTC'):
13+
if not date:
14+
return False
15+
if not tz:
16+
tz = u'UTC'
17+
new_date = str2datetime(date) if isinstance(date, str) else date
18+
new_date = new_date.replace(tzinfo=utc)
19+
local_date = new_date.astimezone(timezone(tz)).replace(tzinfo=None)
20+
return local_date
21+
22+
23+
def _convert_to_utc_date(date, time=0.0, tz=u'UTC'):
24+
if not date:
25+
return False
26+
if not tz:
27+
tz = u'UTC'
28+
date = date2str(date) if isinstance(date, datetype) else date
29+
date = str2datetime(date) if isinstance(date, str) else date
30+
date += relativedelta(hours=float(time))
31+
local = timezone(tz)
32+
local_date = local.localize(date, is_dst=None)
33+
utc_date = local_date.astimezone(utc).replace(tzinfo=None)
34+
return utc_date
35+
36+
37+
def _convert_time_to_float(date, tz=u'UTC'):
38+
if not date:
39+
return False
40+
if not tz:
41+
tz = u'UTC'
42+
local_time = _convert_to_local_date(date, tz=tz)
43+
hour = float(local_time.hour)
44+
minutes = float(local_time.minute) / 60
45+
seconds = float(local_time.second) / 360
46+
return (hour + minutes + seconds)
47+
48+
49+
def _catch_dayofweek(date):
50+
day = str(date.weekday())
51+
if day == '0':
52+
return _('Monday')
53+
if day == '1':
54+
return _('Tuesday')
55+
if day == '2':
56+
return _('Wednesday')
57+
if day == '3':
58+
return _('Thursday')
59+
if day == '4':
60+
return _('Friday')
61+
if day == '5':
62+
return _('Saturday')
63+
if day == '6':
64+
return _('Sunday')

0 commit comments

Comments
 (0)