Skip to content

Commit

Permalink
[16.0][ADD] hr_attendance_leave_report: In Attendances new menu optio…
Browse files Browse the repository at this point in the history
…n: "Attendances And Leaves".
  • Loading branch information
alfredoavanzosc committed Oct 9, 2024
1 parent a8e8f42 commit 738f4dd
Show file tree
Hide file tree
Showing 22 changed files with 2,300 additions and 0 deletions.
35 changes: 35 additions & 0 deletions hr_attendance_leave_report/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
.. 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 leave report
==========================

* For users in Attendances new menu option: "User Attendances And Absences", the
user can see their own attendances and absences.
* For manager in Attendances, Reporting, new menu option: "Attendances And
Absences", for see all users attendances and Absences.
* With this new option, the worker's information will be displayed, with days
worked, holidays, and absences.
* As a condition... that the worker has an assigned contract.


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.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Contributors
------------

* Ana Juaristi <[email protected]>
* Alfredo de la Fuente <[email protected]>
13 changes: 13 additions & 0 deletions hr_attendance_leave_report/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from . import models
from odoo import api, SUPERUSER_ID


def _post_install_put_dates_without_hour(cr, registry):
"""
This method will set the production cost on already done manufacturing orders.
"""
env = api.Environment(cr, SUPERUSER_ID, {})
admin_user = env.ref("base.user_admin")
env["hr.attendance"].with_user(admin_user)._put_dates_without_hour()
env["resource.calendar.leaves"].with_user(admin_user)._put_dates_without_hour()
env["hr.leave"].with_user(admin_user)._put_dates_without_hour()
19 changes: 19 additions & 0 deletions hr_attendance_leave_report/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2024 Alfredo de la Fuente - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Hr Attendance Leave Report",
"version": "16.0.1.0.0",
"category": "Human Resources/Attendances",
"license": "AGPL-3",
"author": "AvanzOSC",
"website": "https://github.com/avanzosc/hr-addons",
"depends": ["contract", "resource", "hr_attendance", "hr_holidays"],
"data": [
"security/ir.model.access.csv",
"security/hr_attendance_leave_report_security.xml",
"views/hr_attendance_views.xml",
"views/hr_attendance_leave_views.xml",
],
"installable": True,
"post_init_hook": "_post_install_put_dates_without_hour",
}
34 changes: 34 additions & 0 deletions hr_attendance_leave_report/_common.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright 2024 Alfredo de la Fuente - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from datetime import datetime

import pytz
from dateutil.relativedelta import relativedelta


def _get_local_date(date_to_convert, tz="UTC"):
if isinstance(date_to_convert, str):
date_to_convert = datetime.strptime(date_to_convert, "%Y-%m-%d %H:%M:%S")
local_tz = pytz.timezone(tz)
if date_to_convert.tzinfo is None:
date_to_convert = pytz.utc.localize(date_to_convert)
return date_to_convert.astimezone(local_tz)


def _catch_employees_dates_to_treat(
employee_dates, employee, date_from, date_to, today_date
):
date_from = date_from
date_to = date_to
while date_from <= date_to:
found_company_employee = False
for employee_date in employee_dates:
if employee_date.get("employee") == employee:
found_company_employee = True
if date_from not in employee_date.get("work_date"):
employee_date["work_date"].append(date_from)
if not found_company_employee:
vals = {"employee": employee, "work_date": [date_from]}
employee_dates.append(vals)
date_from = date_from + relativedelta(days=1)
return employee_dates
260 changes: 260 additions & 0 deletions hr_attendance_leave_report/i18n/ca_ES.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,260 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * hr_attendance_leave_report
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-09 11:41+0000\n"
"PO-Revision-Date: 2024-10-09 11:41+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: hr_attendance_leave_report
#: model:ir.model,name:hr_attendance_leave_report.model_hr_attendance
msgid "Attendance"
msgstr "Assistència"

#. module: hr_attendance_leave_report
#: model:ir.ui.menu,name:hr_attendance_leave_report.menu_hr_attendance2_report
msgid "Attendances"
msgstr ""

#. module: hr_attendance_leave_report
#: model:ir.actions.act_window,name:hr_attendance_leave_report.action_hr_attendance_leave_manager
#: model:ir.model,name:hr_attendance_leave_report.model_hr_attendance_leave
#: model:ir.model.fields,field_description:hr_attendance_leave_report.field_hr_employee__attendance_leave_ids
#: model:ir.ui.menu,name:hr_attendance_leave_report.menu_hr_attendance_leave_manager
#: model_terms:ir.ui.view,arch_db:hr_attendance_leave_report.hr_attendance_leave_calendar_view
msgid "Attendances And Absences"
msgstr ""

#. module: hr_attendance_leave_report
#: model:ir.model.fields,field_description:hr_attendance_leave_report.field_hr_attendance__check_in_without_hour
msgid "Check In Without Hour"
msgstr ""

#. module: hr_attendance_leave_report
#: model:ir.model.fields,field_description:hr_attendance_leave_report.field_hr_attendance__check_out_without_hour
msgid "Check Out Without Hour"
msgstr ""

#. module: hr_attendance_leave_report
#: model:ir.model.fields,field_description:hr_attendance_leave_report.field_hr_attendance_leave__company_id
msgid "Company"
msgstr ""

#. module: hr_attendance_leave_report
#: model:ir.model.fields,field_description:hr_attendance_leave_report.field_hr_attendance_leave__contract_id
msgid "Contract"
msgstr ""

#. module: hr_attendance_leave_report
#: model:ir.model.fields,field_description:hr_attendance_leave_report.field_hr_attendance_leave__create_uid
msgid "Created by"
msgstr ""

#. module: hr_attendance_leave_report
#: model:ir.model.fields,field_description:hr_attendance_leave_report.field_hr_attendance_leave__create_date
msgid "Created on"
msgstr ""

#. module: hr_attendance_leave_report
#: model_terms:ir.ui.view,arch_db:hr_attendance_leave_report.hr_attendance_leave_search_view
msgid "Day Type"
msgstr ""

#. module: hr_attendance_leave_report
#: model:ir.model.fields,field_description:hr_attendance_leave_report.field_hr_attendance_leave__day_type
msgid "Day type"
msgstr ""

#. module: hr_attendance_leave_report
#: model:ir.model.fields,field_description:hr_attendance_leave_report.field_hr_attendance_leave__department_id
#: model_terms:ir.ui.view,arch_db:hr_attendance_leave_report.hr_attendance_leave_search_view
msgid "Department"
msgstr ""

#. module: hr_attendance_leave_report
#: model:ir.model.fields,field_description:hr_attendance_leave_report.field_hr_attendance_leave__display_name
msgid "Display Name"
msgstr ""

#. module: hr_attendance_leave_report
#: model:ir.model,name:hr_attendance_leave_report.model_hr_employee
#: model:ir.model.fields,field_description:hr_attendance_leave_report.field_hr_attendance_leave__employee_id
#: model_terms:ir.ui.view,arch_db:hr_attendance_leave_report.hr_attendance_leave_search_view
#: model_terms:ir.ui.view,arch_db:hr_attendance_leave_report.hr_attendance_leave_tree_view
msgid "Employee"
msgstr "Empleat"

#. module: hr_attendance_leave_report
#: model:ir.model.fields,field_description:hr_attendance_leave_report.field_hr_leave__date_to_without_hour
#: model:ir.model.fields,field_description:hr_attendance_leave_report.field_resource_calendar_leaves__date_to_without_hour
msgid "End Date Without Hour"
msgstr ""

#. module: hr_attendance_leave_report
#: model:ir.model.fields,field_description:hr_attendance_leave_report.field_hr_attendance_leave__extra_hours
msgid "Extra hours"
msgstr ""

#. module: hr_attendance_leave_report
#: model:ir.model.fields,field_description:hr_attendance_leave_report.field_hr_attendance_leave__calendar_leave_id
msgid "Festive"
msgstr ""

#. module: hr_attendance_leave_report
#: model_terms:ir.ui.view,arch_db:hr_attendance_leave_report.hr_attendance_leave_search_view
msgid "Group By"
msgstr ""

#. module: hr_attendance_leave_report
#: model:ir.model.fields,field_description:hr_attendance_leave_report.field_hr_attendance_leave__hours_to_work
msgid "Hours To Work"
msgstr ""

#. module: hr_attendance_leave_report
#: model:ir.model.fields,field_description:hr_attendance_leave_report.field_hr_attendance_leave__id
msgid "ID"
msgstr ""

#. module: hr_attendance_leave_report
#: model:ir.model.fields,field_description:hr_attendance_leave_report.field_hr_attendance_leave__is_normal_day
msgid "Is Normal Day"
msgstr ""

#. module: hr_attendance_leave_report
#: model:ir.model.fields,field_description:hr_attendance_leave_report.field_hr_attendance_leave____last_update
msgid "Last Modified on"
msgstr ""

#. module: hr_attendance_leave_report
#: model:ir.model.fields,field_description:hr_attendance_leave_report.field_hr_attendance_leave__write_uid
msgid "Last Updated by"
msgstr ""

#. module: hr_attendance_leave_report
#: model:ir.model.fields,field_description:hr_attendance_leave_report.field_hr_attendance_leave__write_date
msgid "Last Updated on"
msgstr ""

#. module: hr_attendance_leave_report
#: model:ir.model.fields,field_description:hr_attendance_leave_report.field_hr_attendance_leave__leave_type_id
msgid "Leave Type"
msgstr ""

#. module: hr_attendance_leave_report
#. odoo-python
#: code:addons/hr_attendance_leave_report/models/hr_leave_type.py:0
#, python-format
msgid ""
"Leave type: '%s', exists in any absence of a worker. You can disable this "
"one, and create a new one."
msgstr ""

#. module: hr_attendance_leave_report
#: model:ir.model.fields,field_description:hr_attendance_leave_report.field_hr_attendance_leave__non_remunerated_hours
msgid "Non Remunerated Hours"
msgstr ""

#. module: hr_attendance_leave_report
#. odoo-python
#: code:addons/hr_attendance_leave_report/models/hr_attendance_leave.py:0
#: code:addons/hr_attendance_leave_report/models/hr_attendance_leave.py:0
#, python-format
msgid "Normal Day"
msgstr ""

#. module: hr_attendance_leave_report
#: model:ir.model.fields,help:hr_attendance_leave_report.field_hr_attendance_leave__user_id
msgid "Related user name for the resource to manage its access."
msgstr ""

#. module: hr_attendance_leave_report
#: model:ir.model.fields,field_description:hr_attendance_leave_report.field_hr_attendance_leave__remunerated_hours
msgid "Remunerated Hours"
msgstr ""

#. module: hr_attendance_leave_report
#: model:ir.model,name:hr_attendance_leave_report.model_resource_calendar_leaves
msgid "Resource Time Off Detail"
msgstr "Detall del temps lliure dels recursos"

#. module: hr_attendance_leave_report
#: model_terms:ir.ui.view,arch_db:hr_attendance_leave_report.hr_attendance_leave_search_view
msgid "Search Attendances And Absences"
msgstr ""

#. module: hr_attendance_leave_report
#: model:ir.model.fields,field_description:hr_attendance_leave_report.field_hr_leave__date_from_without_hour
#: model:ir.model.fields,field_description:hr_attendance_leave_report.field_resource_calendar_leaves__date_from_without_hour
msgid "Start Date Without Hour"
msgstr ""

#. module: hr_attendance_leave_report
#: model:ir.model,name:hr_attendance_leave_report.model_hr_leave
msgid "Time Off"
msgstr "Absències"

#. module: hr_attendance_leave_report
#: model:ir.model,name:hr_attendance_leave_report.model_hr_leave_type
msgid "Time Off Type"
msgstr "Tipus d'absència"

#. module: hr_attendance_leave_report
#: model_terms:ir.ui.view,arch_db:hr_attendance_leave_report.hr_attendance_leave_tree_view
msgid "Total Extra Hours"
msgstr ""

#. module: hr_attendance_leave_report
#: model_terms:ir.ui.view,arch_db:hr_attendance_leave_report.hr_attendance_leave_tree_view
msgid "Total Hours To Work"
msgstr ""

#. module: hr_attendance_leave_report
#: model_terms:ir.ui.view,arch_db:hr_attendance_leave_report.hr_attendance_leave_tree_view
msgid "Total Non Remunerated Hours"
msgstr ""

#. module: hr_attendance_leave_report
#: model_terms:ir.ui.view,arch_db:hr_attendance_leave_report.hr_attendance_leave_tree_view
msgid "Total Remunerated Hours"
msgstr ""

#. module: hr_attendance_leave_report
#: model_terms:ir.ui.view,arch_db:hr_attendance_leave_report.hr_attendance_leave_tree_view
msgid "Total Worked Hours"
msgstr ""

#. module: hr_attendance_leave_report
#: model:ir.model.fields,field_description:hr_attendance_leave_report.field_hr_attendance_leave__user_id
msgid "User"
msgstr ""

#. module: hr_attendance_leave_report
#: model:ir.actions.act_window,name:hr_attendance_leave_report.action_hr_attendance_leave_user
#: model:ir.ui.menu,name:hr_attendance_leave_report.menu_hr_attendance_leave
msgid "User Attendances And Absences"
msgstr ""

#. module: hr_attendance_leave_report
#: model:ir.model.fields,field_description:hr_attendance_leave_report.field_hr_attendance_leave__user_name
msgid "User Name"
msgstr ""

#. module: hr_attendance_leave_report
#: model:ir.model.fields,field_description:hr_attendance_leave_report.field_hr_attendance_leave__work_day
#: model_terms:ir.ui.view,arch_db:hr_attendance_leave_report.hr_attendance_leave_search_view
msgid "Work Day"
msgstr ""

#. module: hr_attendance_leave_report
#: model:ir.model.fields,field_description:hr_attendance_leave_report.field_hr_attendance_leave__worked_hours
msgid "Worked hours"
msgstr ""
Loading

0 comments on commit 738f4dd

Please sign in to comment.