Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions hr_attendance_resume/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.. 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
====================

* New object "Hours imputations resume". The new menu option for this object is
found in Attendances - Manage attendances - Imputations resume. To see this
new menu option, the user must be in the group "Attendance-Manager".
* In attendances new wizard for impute then in assistances resume.

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 <anajuaristi@avanzosc.es>
* Alfredo de la Fuente <alfredodelafuente@avanzosc.es>

Do not contact contributors directly about support or help with technical issues.
4 changes: 4 additions & 0 deletions hr_attendance_resume/__init__.py
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
26 changes: 26 additions & 0 deletions hr_attendance_resume/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2019 Alfredo de la Fuente - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
{
"name": "Hr Attendance Resume",
"version": "12.0.1.0.0",
"license": "AGPL-3",
"depends": [
"hr_attendance",
"resource_time",
"resource_rest_time",
"resource_bonus",
"hr_employee_calendar_planning"
],
"author": "AvanzOSC",
"website": "http://www.avanzosc.es",
"category": "Human Resources",
"data": [
"security/ir.model.access.csv",
"views/hr_attendance_view.xml",
"views/hr_attendance_resume_view.xml",
"views/hr_employee_view.xml",
"wizard/wiz_hr_attendance_resume_view.xml",
"wizard/wiz_hr_attendance_uncheck_treaties_view.xml",
],
"installable": True,
}
64 changes: 64 additions & 0 deletions hr_attendance_resume/_common.py
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')
Loading