diff --git a/hr_attendance_leave_report/README.rst b/hr_attendance_leave_report/README.rst new file mode 100644 index 0000000..e4ed72b --- /dev/null +++ b/hr_attendance_leave_report/README.rst @@ -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 +`_. 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 +* Alfredo de la Fuente diff --git a/hr_attendance_leave_report/__init__.py b/hr_attendance_leave_report/__init__.py new file mode 100644 index 0000000..badaa6b --- /dev/null +++ b/hr_attendance_leave_report/__init__.py @@ -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() diff --git a/hr_attendance_leave_report/__manifest__.py b/hr_attendance_leave_report/__manifest__.py new file mode 100644 index 0000000..4c50b78 --- /dev/null +++ b/hr_attendance_leave_report/__manifest__.py @@ -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", +} diff --git a/hr_attendance_leave_report/_common.py b/hr_attendance_leave_report/_common.py new file mode 100644 index 0000000..f1712a5 --- /dev/null +++ b/hr_attendance_leave_report/_common.py @@ -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 diff --git a/hr_attendance_leave_report/i18n/ca_ES.po b/hr_attendance_leave_report/i18n/ca_ES.po new file mode 100644 index 0000000..db1a44b --- /dev/null +++ b/hr_attendance_leave_report/i18n/ca_ES.po @@ -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 "" diff --git a/hr_attendance_leave_report/i18n/en_GB.po b/hr_attendance_leave_report/i18n/en_GB.po new file mode 100644 index 0000000..d562faf --- /dev/null +++ b/hr_attendance_leave_report/i18n/en_GB.po @@ -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 "" + +#. 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 "" + +#. 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 "" + +#. 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 "" + +#. module: hr_attendance_leave_report +#: model:ir.model,name:hr_attendance_leave_report.model_hr_leave_type +msgid "Time Off Type" +msgstr "" + +#. 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 "" diff --git a/hr_attendance_leave_report/i18n/es.po b/hr_attendance_leave_report/i18n/es.po new file mode 100644 index 0000000..7b17856 --- /dev/null +++ b/hr_attendance_leave_report/i18n/es.po @@ -0,0 +1,262 @@ +# 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:42+0000\n" +"PO-Revision-Date: 2024-10-09 11:42+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 "Asistencia" + +#. module: hr_attendance_leave_report +#: model:ir.ui.menu,name:hr_attendance_leave_report.menu_hr_attendance2_report +msgid "Attendances" +msgstr "Asistencias" + +#. 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 "Asistencias y ausencias" + +#. 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 "Hora entrada sin hora" + +#. 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 "Hora salida sin hora" + +#. module: hr_attendance_leave_report +#: model:ir.model.fields,field_description:hr_attendance_leave_report.field_hr_attendance_leave__company_id +msgid "Company" +msgstr "Compañía" + +#. module: hr_attendance_leave_report +#: model:ir.model.fields,field_description:hr_attendance_leave_report.field_hr_attendance_leave__contract_id +msgid "Contract" +msgstr "Contrato" + +#. 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 "Agrupar por" + +#. 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 "Creado el" + +#. 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 "Tipo día" + +#. 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 "Tipo día" + +#. 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 "Departamento" + +#. 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 "Mostrar nombre" + +#. 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 "Empleado" + +#. 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 "Fecha fin sin hora" + +#. 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 "Horas extra" + +#. 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 "Festivo" + +#. 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 "Agrupar por" + +#. 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 "Horas a trabajar" + +#. module: hr_attendance_leave_report +#: model:ir.model.fields,field_description:hr_attendance_leave_report.field_hr_attendance_leave__id +msgid "ID" +msgstr "ID" + +#. 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 "Es día normal" + +#. 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 "Última modificación el" + +#. 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 "Última actualización por" + +#. 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 "Última actualización el" + +#. 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 "Tipo ausencia" + +#. 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 "" +"Tipo ausencia: '%s', existe en alguana ausencia de trabajador. Puede desactivar " +"esta, y crear una nueva." + +#. 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 "Horas NO Remuneradas" + +#. 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 "Día normal" + +#. 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 "Nombre de usuario relacionado con el recurso para administrar su acceso." + +#. 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 "Hora remuneradas" + +#. module: hr_attendance_leave_report +#: model:ir.model,name:hr_attendance_leave_report.model_resource_calendar_leaves +msgid "Resource Time Off Detail" +msgstr "Detalle de las ausencias del recurso" + +#. 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 "Buscar asistencias y ausencias" + +#. 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 "Fecha inicio sin hora" + +#. module: hr_attendance_leave_report +#: model:ir.model,name:hr_attendance_leave_report.model_hr_leave +msgid "Time Off" +msgstr "Ausencias" + +#. module: hr_attendance_leave_report +#: model:ir.model,name:hr_attendance_leave_report.model_hr_leave_type +msgid "Time Off Type" +msgstr "Tipo de ausencia" + +#. 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 "Total horas extra" + +#. 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 "Total horas a trabajar" + +#. 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 "Total horas NO Remuneradas" + +#. 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 "Total horas remuneradas" + +#. 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 "Total horas trabajadas" + +#. module: hr_attendance_leave_report +#: model:ir.model.fields,field_description:hr_attendance_leave_report.field_hr_attendance_leave__user_id +msgid "User" +msgstr "Usuario" + +#. 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 "Usuario asistencias y ausencias" + +#. 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 "Nombre usuario" + +#. 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 "Día trabajo" + +#. 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 "Horas trabajadas" diff --git a/hr_attendance_leave_report/i18n/fr.po b/hr_attendance_leave_report/i18n/fr.po new file mode 100644 index 0000000..9093f90 --- /dev/null +++ b/hr_attendance_leave_report/i18n/fr.po @@ -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 "Présences" + +#. 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 "Employé" + +#. 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 "Détails des congés des ressources" + +#. 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 "Congés" + +#. module: hr_attendance_leave_report +#: model:ir.model,name:hr_attendance_leave_report.model_hr_leave_type +msgid "Time Off Type" +msgstr "Type de congés" + +#. 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 "" diff --git a/hr_attendance_leave_report/i18n/hr_attendance_leave_report.pot b/hr_attendance_leave_report/i18n/hr_attendance_leave_report.pot new file mode 100644 index 0000000..d562faf --- /dev/null +++ b/hr_attendance_leave_report/i18n/hr_attendance_leave_report.pot @@ -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 "" + +#. 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 "" + +#. 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 "" + +#. 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 "" + +#. module: hr_attendance_leave_report +#: model:ir.model,name:hr_attendance_leave_report.model_hr_leave_type +msgid "Time Off Type" +msgstr "" + +#. 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 "" diff --git a/hr_attendance_leave_report/models/__init__.py b/hr_attendance_leave_report/models/__init__.py new file mode 100644 index 0000000..94dc641 --- /dev/null +++ b/hr_attendance_leave_report/models/__init__.py @@ -0,0 +1,6 @@ +from . import hr_attendance_leave +from . import hr_attendance +from . import hr_employee +from . import hr_leave_type +from . import hr_leave +from . import resource_calendar_leaves diff --git a/hr_attendance_leave_report/models/hr_attendance.py b/hr_attendance_leave_report/models/hr_attendance.py new file mode 100644 index 0000000..61a8eca --- /dev/null +++ b/hr_attendance_leave_report/models/hr_attendance.py @@ -0,0 +1,90 @@ +# Copyright 2024 Alfredo de la Fuente - AvanzOSC +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from odoo import api, fields, models + +from .._common import _catch_employees_dates_to_treat, _get_local_date + + +class HrAttendance(models.Model): + _inherit = "hr.attendance" + + check_in_without_hour = fields.Date(copy=False) + check_out_without_hour = fields.Date(copy=False) + + @api.model_create_multi + def create(self, vals_list): + hr_attendance_leave_obj = self.env["hr.attendance.leave"] + for vals in vals_list: + if "check_in" in vals: + vals["check_in_without_hour"] = _get_local_date( + vals.get("check_in"), self.env.user.tz + ) + if "check_out" in vals: + if vals.get("check_out", False): + vals["check_out_without_hour"] = _get_local_date( + vals.get("check_out"), self.env.user.tz + ) + else: + vals["check_out_without_hour"] = False + attendances = super().create(vals_list) + employees_dates = attendances._catch_employees_check_in_out_dates([]) + if employees_dates: + hr_attendance_leave_obj._treat_employee_dates(employees_dates) + return attendances + + def write(self, vals): + hr_attendance_leave_obj = self.env["hr.attendance.leave"] + if "check_in" in vals: + vals["check_in_without_hour"] = _get_local_date( + vals.get("check_in"), self.env.user.tz + ) + if "check_out" in vals: + if vals.get("check_out", False): + vals["check_out_without_hour"] = _get_local_date( + vals.get("check_out"), self.env.user.tz + ) + else: + vals["check_out_without_hour"] = False + employees_dates = self._catch_employees_check_in_out_dates([]) + result = super().write(vals) + if "check_in_without_hour" in vals or "check_in_without_hour" in vals: + employees_dates = self._catch_employees_check_in_out_dates(employees_dates) + if employees_dates: + hr_attendance_leave_obj._treat_employee_dates(employees_dates) + return result + + def unlink(self): + hr_attendance_leave_obj = self.env["hr.attendance.leave"] + employees_dates = self._catch_employees_check_in_out_dates([]) + result = super().unlink() + if employees_dates: + hr_attendance_leave_obj._treat_employee_dates(employees_dates) + return result + + def _catch_employees_check_in_out_dates(self, employees_dates): + for attendance in self.filtered( + lambda x: x.check_in_without_hour and x.check_out_without_hour + ): + employees_dates = _catch_employees_dates_to_treat( + employees_dates, + attendance.employee_id, + attendance.check_in_without_hour, + attendance.check_out_without_hour, + fields.Date.context_today(self), + ) + return employees_dates + + def _put_dates_without_hour(self): + attendances = self.search([]) + for attendance in attendances: + vals = {} + if attendance.check_in: + vals["check_in_without_hour"] = _get_local_date( + attendance.check_in, self.env.user.tz + ) + if attendance.check_out: + vals["check_out_without_hour"] = _get_local_date( + attendance.check_out, self.env.user.tz + ) + if vals: + attendance.write(vals) diff --git a/hr_attendance_leave_report/models/hr_attendance_leave.py b/hr_attendance_leave_report/models/hr_attendance_leave.py new file mode 100644 index 0000000..894524f --- /dev/null +++ b/hr_attendance_leave_report/models/hr_attendance_leave.py @@ -0,0 +1,275 @@ +# Copyright 2024 Alfredo de la Fuente - AvanzOSC +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from odoo import _, api, fields, models + + +class HrAttendanceLeave(models.Model): + _name = "hr.attendance.leave" + _description = "Attendances And Absences" + _rec_name = "day_type" + _order = "work_day desc, user_name asc" + + work_day = fields.Date(copy=False, index=True) + employee_id = fields.Many2one( + string="Employee", comodel_name="hr.employee", copy=False, index=True + ) + company_id = fields.Many2one( + string="Company", + comodel_name="res.company", + store=True, + copy=False, + related="employee_id.company_id", + ) + user_id = fields.Many2one( + string="User", + comodel_name="res.users", + store=True, + copy=False, + related="employee_id.user_id", + ) + user_name = fields.Char( + string="User Name", related="employee_id.user_id.name", store=True, copy=False + ) + display_name = fields.Char( + string="Display Name", + compute="_compute_attendance_leave_info", + store=True, + copy=False, + ) + contract_id = fields.Many2one( + string="Contract", comodel_name="hr.contract", copy=False + ) + department_id = fields.Many2one( + string="Department", + comodel_name="hr.department", + related="contract_id.department_id", + store=True, + copy=False, + ) + day_type = fields.Char( + string="Day type", + compute="_compute_attendance_leave_info", + store=True, + copy=False, + translate=True, + ) + is_normal_day = fields.Boolean(default=False, copy=False) + leave_type_id = fields.Many2one( + string="Leave Type", comodel_name="hr.leave.type", copy=False + ) + calendar_leave_id = fields.Many2one( + string="Festive", comodel_name="resource.calendar.leaves", copy=False + ) + hours_to_work = fields.Float(default=0.0, copy=False) + worked_hours = fields.Float(string="Worked hours", default=0.0, copy=False) + remunerated_hours = fields.Float(default=0.0, copy=False) + non_remunerated_hours = fields.Float( + compute="_compute_attendance_leave_info", + compute_sudo=True, + copy=False, + store=True, + ) + extra_hours = fields.Float( + compute="_compute_attendance_leave_info", + compute_sudo=True, + string="Extra hours", + copy=False, + store=True, + ) + + @api.depends( + "is_normal_day", + "leave_type_id", + "leave_type_id.name", + "calendar_leave_id", + "calendar_leave_id.name", + ) + def _compute_day_type(self): + for attendance_leave in self: + day_type = _("Normal Day") + if attendance_leave.calendar_leave_id: + day_type = attendance_leave.calendar_leave_id.name + if attendance_leave.leave_type_id: + day_type = attendance_leave.leave_type_id.name + attendance_leave.day_type = day_type + + @api.depends( + "is_normal_day", + "leave_type_id", + "leave_type_id.name", + "calendar_leave_id", + "calendar_leave_id.name", + "hours_to_work", + "worked_hours", + "remunerated_hours", + ) + def _compute_attendance_leave_info(self): + for line in self: + day_type = _("Normal Day") + if line.calendar_leave_id: + day_type = line.calendar_leave_id.name + if line.leave_type_id: + day_type = line.leave_type_id.name + non_remunerated_hours = 0 + extra_hours = 0 + if not line.leave_type_id and not line.calendar_leave_id: + extra_hours = line.worked_hours - line.hours_to_work + if line.calendar_leave_id or ( + line.leave_type_id and line.leave_type_id.time_type == "other" + ): + if line.worked_hours == 0: + extra_hours = (line.hours_to_work - line.remunerated_hours) * -1 + else: + if line.worked_hours <= line.remunerated_hours: + extra_hours = ( + line.hours_to_work + - line.remunerated_hours + + line.worked_hours + ) + else: + extra_hours = line.worked_hours - ( + line.hours_to_work - line.remunerated_hours + ) + + if line.leave_type_id and line.leave_type_id.time_type != "other": + non_remunerated_hours = line.hours_to_work - line.worked_hours + if non_remunerated_hours > line.hours_to_work: + non_remunerated_hours = line.hours_to_work + if line.worked_hours == 0: + extra_hours = line.hours_to_work * -1 + elif line.worked_hours < line.hours_to_work: + extra_hours = line.worked_hours - line.hours_to_work + else: + extra_hours = line.hours_to_work - line.worked_hours + line.day_type = day_type + line.non_remunerated_hours = non_remunerated_hours + line.extra_hours = extra_hours + line.display_name = line.employee_id.name + + def _treat_employee_dates(self, employees_dates): + for employee_date in employees_dates: + for date_to_treat in employee_date.get("work_date"): + self._update_attendance_leave_info( + employee=employee_date.get("employee"), work_date=date_to_treat + ) + + def _update_attendance_leave_info(self, employee, work_date): + contract, vals = self._initialize_vals(employee, work_date) + if contract: + vals = self._get_festive(contract, work_date, vals) + if contract and not vals.get("calendar_leave_id"): + vals = self._get_leave(contract, work_date, vals) + if ( + contract + and not vals.get("leave_type_id") + and not vals.get("calendar_leave_id") not in vals + ): + vals["is_normal_day"] = True + attendance_leave = employee.attendance_leave_ids.filtered( + lambda x: x.work_day == work_date and x.employee_id == employee + ) + if not contract and attendance_leave: + attendance_leave.unlink() + if ( + contract + and attendance_leave + and vals.get("hours_to_work") == 0 + and vals.get("worked_hours") == 0 + ): + attendance_leave.unlink() + if ( + contract + and attendance_leave + and (vals.get("hours_to_work") != 0 or vals.get("worked_hours") != 0) + ): + attendance_leave.write(vals) + + if ( + contract + and not attendance_leave + and (vals.get("hours_to_work") != 0 or vals.get("worked_hours") != 0) + ): + vals["work_day"] = work_date + vals["employee_id"] = employee.id + attendance_leave.create(vals) + + def _initialize_vals(self, employee, work_date): + hours_to_work, contract = self._catch_hours_of_work_schedule( + employee, work_date + ) + worked_hours = self._catch_worked_hours_on_work_date(employee, work_date) + vals = { + "contract_id": contract.id if contract else False, + "hours_to_work": hours_to_work, + "worked_hours": worked_hours, + "extra_hours": worked_hours - hours_to_work, + "calendar_leave_id": False, + "leave_type_id": False, + "remunerated_hours": 0.0, + "non_remunerated_hours": 0.0, + } + return contract, vals + + def _catch_hours_of_work_schedule(self, employee, work_date): + contract = employee.contract_ids.filtered( + lambda x: x.company_id == employee.company_id + and x.date_start <= work_date + and (not x.date_end or x.date_end >= work_date) + ) + if ( + not contract + or not contract.resource_calendar_id + or not contract.resource_calendar_id.attendance_ids + ): + return 0, False + lines = contract.resource_calendar_id.attendance_ids.filtered( + lambda x: x.dayofweek == str(work_date.weekday()) + ) + hours_to_work = 0 + for line in lines: + hours_to_work += line.hour_to - line.hour_from + return hours_to_work, contract + + def _catch_worked_hours_on_work_date(self, employee, work_date): + attendances = employee.attendance_ids.filtered( + lambda x: x.check_in_without_hour == work_date and x.check_out_without_hour + ) + if not attendances: + return 0 + return sum(attendances.mapped("worked_hours")) + + def _get_festive(self, contract, work_date, vals): + if contract.resource_calendar_id: + cond = [ + ("company_id", "=", contract.company_id.id), + ("calendar_id", "=", contract.resource_calendar_id.id), + ("resource_id", "=", False), + ("date_from_without_hour", "<=", work_date), + ("date_to_without_hour", ">=", work_date), + ] + festive = self.env["resource.calendar.leaves"].search(cond, limit=1) + if festive: + vals["calendar_leave_id"] = festive.id + vals["remunerated_hours"] = vals.get("hours_to_work") + return vals + + def _get_leave(self, contract, work_date, vals): + cond = [ + ("employee_company_id", "=", contract.company_id.id), + ("employee_id", "=", contract.employee_id.id), + ("date_from_without_hour", "<=", work_date), + ("date_to_without_hour", ">=", work_date), + ("state", "=", "validate"), + ] + leave = self.env["hr.leave"].search(cond, limit=1) + if leave: + hours = vals.get("hours_to_work") + if leave.holiday_status_id.request_unit != "day": + difference = leave.date_to - leave.date_from + hours_difference = difference.total_seconds() / 3600 + if hours_difference < hours: + hours = hours_difference + vals["leave_type_id"] = leave.holiday_status_id.id + if leave.holiday_status_id.time_type == "other": + vals["remunerated_hours"] = hours + return vals diff --git a/hr_attendance_leave_report/models/hr_employee.py b/hr_attendance_leave_report/models/hr_employee.py new file mode 100644 index 0000000..df5ab57 --- /dev/null +++ b/hr_attendance_leave_report/models/hr_employee.py @@ -0,0 +1,14 @@ +# Copyright 2024 Alfredo de la Fuente - AvanzOSC +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from odoo import fields, models + + +class HrEmpployee(models.Model): + _inherit = "hr.employee" + + attendance_leave_ids = fields.One2many( + string="Attendances And Absences", + comodel_name="hr.attendance.leave", + inverse_name="employee_id", + copy=False, + ) diff --git a/hr_attendance_leave_report/models/hr_leave.py b/hr_attendance_leave_report/models/hr_leave.py new file mode 100644 index 0000000..db5fa33 --- /dev/null +++ b/hr_attendance_leave_report/models/hr_leave.py @@ -0,0 +1,90 @@ +# Copyright 2024 Alfredo de la Fuente - AvanzOSC +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from odoo import api, fields, models + +from .._common import _catch_employees_dates_to_treat, _get_local_date + + +class HrLeave(models.Model): + _inherit = "hr.leave" + + date_from_without_hour = fields.Date(string="Start Date Without Hour", copy=False) + date_to_without_hour = fields.Date(string="End Date Without Hour", copy=False) + + @api.model_create_multi + def create(self, vals_list): + hr_attendance_leave_obj = self.env["hr.attendance.leave"] + for vals in vals_list: + if "date_from" in vals: + vals["date_from_without_hour"] = _get_local_date( + vals.get("date_from"), self.env.user.tz + ) + if "date_to" in vals: + vals["date_to_without_hour"] = _get_local_date( + vals.get("date_to"), self.env.user.tz + ) + leaves = super().create(vals_list) + employees_dates = leaves._catch_employees_check_in_out_dates([]) + if employees_dates: + hr_attendance_leave_obj._treat_employee_dates(employees_dates) + return leaves + + def write(self, vals): + hr_attendance_leave_obj = self.env["hr.attendance.leave"] + if "date_from" in vals: + vals["date_from_without_hour"] = _get_local_date( + vals.get("date_from"), self.env.user.tz + ) + if "date_to" in vals: + vals["date_to_without_hour"] = _get_local_date( + vals.get("date_to"), self.env.user.tz + ) + employees_dates = self._catch_employees_check_in_out_dates([]) + result = super().write(vals) + if ( + "date_from_without_hour" in vals + or "date_to_without_hour" in vals + or "state" in vals + ): + employees_dates = self._catch_employees_check_in_out_dates(employees_dates) + if employees_dates: + hr_attendance_leave_obj._treat_employee_dates(employees_dates) + return result + + def unlink(self): + hr_attendance_leave_obj = self.env["hr.attendance.leave"] + employees_dates = self._catch_employees_check_in_out_dates([]) + result = super().unlink() + if employees_dates: + hr_attendance_leave_obj._treat_employee_dates(employees_dates) + return result + + def _catch_employees_check_in_out_dates(self, employees_dates): + for leave in self.filtered( + lambda x: x.date_from_without_hour and x.date_to_without_hour + ): + employees_dates = _catch_employees_dates_to_treat( + employees_dates, + leave.employee_id, + leave.date_from_without_hour, + leave.date_to_without_hour, + fields.Date.context_today(self), + ) + return employees_dates + + def _put_dates_without_hour(self): + companies = self.env["res.company"].search([]) + for company in companies: + leaves = self.search([("employee_company_id", "=", company.id)]) + for leave in leaves: + vals = {} + if leave.date_from: + vals["date_from_without_hour"] = _get_local_date( + leave.date_from, self.env.user.tz + ) + if leave.date_to: + vals["date_to_without_hour"] = _get_local_date( + leave.date_to, self.env.user.tz + ) + if vals: + leave.write(vals) diff --git a/hr_attendance_leave_report/models/hr_leave_type.py b/hr_attendance_leave_report/models/hr_leave_type.py new file mode 100644 index 0000000..ec294b7 --- /dev/null +++ b/hr_attendance_leave_report/models/hr_leave_type.py @@ -0,0 +1,22 @@ +# Copyright 2024 Alfredo de la Fuente - AvanzOSC +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from odoo import _, models +from odoo.exceptions import ValidationError + + +class HrLeaveType(models.Model): + _inherit = "hr.leave.type" + + def unlink(self): + for leave_type in self: + cond = [("holiday_status_id", "=", leave_type.id)] + leave = self.env["hr.leave"].search(cond, limit=1) + if leave: + raise ValidationError( + _( + "Leave type: '%s', exists in any absence of a worker. " + "You can disable this one, and create a new one." + ) + % leave_type.display_name + ) + return super().unlink() diff --git a/hr_attendance_leave_report/models/resource_calendar_leaves.py b/hr_attendance_leave_report/models/resource_calendar_leaves.py new file mode 100644 index 0000000..2ba2a68 --- /dev/null +++ b/hr_attendance_leave_report/models/resource_calendar_leaves.py @@ -0,0 +1,111 @@ +# Copyright 2024 Alfredo de la Fuente - AvanzOSC +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from dateutil.relativedelta import relativedelta + +from odoo import api, fields, models + +from .._common import _catch_employees_dates_to_treat, _get_local_date + + +class ResourceCandelarLeaves(models.Model): + _inherit = "resource.calendar.leaves" + + date_from_without_hour = fields.Date(string="Start Date Without Hour", copy=False) + date_to_without_hour = fields.Date(string="End Date Without Hour", copy=False) + + @api.model_create_multi + def create(self, vals_list): + hr_attendance_leave_obj = self.env["hr.attendance.leave"] + for vals in vals_list: + if "date_from" in vals: + vals["date_from_without_hour"] = _get_local_date( + vals.get("date_from"), self.env.user.tz + ) + if "date_to" in vals: + vals["date_to_without_hour"] = _get_local_date( + vals.get("date_to"), self.env.user.tz + ) + leaves = super().create(vals_list) + employees_dates = leaves._catch_employees_contract_dates_to_treat([]) + if employees_dates: + hr_attendance_leave_obj._treat_employee_dates(employees_dates) + return leaves + + def write(self, vals): + hr_attendance_leave_obj = self.env["hr.attendance.leave"] + if "date_from" in vals: + vals["date_from_without_hour"] = _get_local_date( + vals.get("date_from"), self.env.user.tz + ) + if "date_to" in vals: + vals["date_to_without_hour"] = _get_local_date( + vals.get("date_to"), self.env.user.tz + ) + employees_dates = self._catch_employees_contract_dates_to_treat([]) + result = super().write(vals) + if "date_from_without_hour" in vals or "date_to_without_hour" in vals: + employees_dates = self._catch_employees_contract_dates_to_treat( + employees_dates + ) + if employees_dates: + hr_attendance_leave_obj._treat_employee_dates(employees_dates) + return result + + def unlink(self): + hr_attendance_leave_obj = self.env["hr.attendance.leave"] + employees_dates = self._catch_employees_contract_dates_to_treat([]) + result = super().unlink() + if employees_dates: + hr_attendance_leave_obj._treat_employee_dates(employees_dates) + return result + + def _catch_employees_contract_dates_to_treat(self, employees_dates): + for leave in self.filtered( + lambda x: x.date_from_without_hour and x.date_to_without_hour + ): + date_from = leave.date_from_without_hour + date_to = leave.date_to_without_hour + if date_from and date_to: + while date_from <= date_to: + cond = [ + ("company_id", "=", leave.company_id.id), + ("resource_calendar_id", "=", leave.calendar_id.id), + ("date_start", "<=", date_from), + "|", + ("date_end", "=", False), + ("date_end", ">=", date_from), + ] + contracts = self.env["hr.contract"].sudo().search(cond) + for contract in contracts: + employees_dates = _catch_employees_dates_to_treat( + employees_dates, + contract.employee_id, + date_from, + date_from, + fields.Date.context_today(self), + ) + date_from = date_from + relativedelta(days=1) + return employees_dates + + def _put_dates_without_hour(self): + companies = self.env["res.company"].search([]) + for company in companies: + leaves = self.search( + [ + ("company_id", "=", company.id), + ("calendar_id", "!=", False), + ("resource_id", "=", False), + ] + ) + for leave in leaves: + vals = {} + if leave.date_from: + vals["date_from_without_hour"] = _get_local_date( + leave.date_from, self.env.user.tz + ) + if leave.date_to: + vals["date_to_without_hour"] = _get_local_date( + leave.date_to, self.env.user.tz + ) + if vals: + leave.write(vals) diff --git a/hr_attendance_leave_report/security/hr_attendance_leave_report_security.xml b/hr_attendance_leave_report/security/hr_attendance_leave_report_security.xml new file mode 100644 index 0000000..d689401 --- /dev/null +++ b/hr_attendance_leave_report/security/hr_attendance_leave_report_security.xml @@ -0,0 +1,21 @@ + + + + User Attendances And Absences + + [('user_id', '=', user.id), ('company_id', 'in', company_ids)] + + + + + All Attendances And Absences + + [('company_id', 'in', company_ids)] + + + diff --git a/hr_attendance_leave_report/security/ir.model.access.csv b/hr_attendance_leave_report/security/ir.model.access.csv new file mode 100644 index 0000000..e77a47f --- /dev/null +++ b/hr_attendance_leave_report/security/ir.model.access.csv @@ -0,0 +1,3 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_hr_attendance_leave_internal_user,hr.attendance.leave.internal.user,model_hr_attendance_leave,base.group_user,1,1,1,1 +access_hr_attendance_leave_attendance_user,hr.attendance.leave.attendance.user,model_hr_attendance_leave,hr_attendance.group_hr_attendance_user,1,1,1,1 diff --git a/hr_attendance_leave_report/views/hr_attendance_leave_views.xml b/hr_attendance_leave_report/views/hr_attendance_leave_views.xml new file mode 100644 index 0000000..c6c10db --- /dev/null +++ b/hr_attendance_leave_report/views/hr_attendance_leave_views.xml @@ -0,0 +1,198 @@ + + + + hr.attendance.leave.tree.view + hr.attendance.leave + + + + + + + + + + + + + + + + + hr.attendance.leave.calendar.view + hr.attendance.leave + + + + + + + + + + + + + + + hr.attendance.leave.search.view + hr.attendance.leave + + + + + + + + + + + + + + + + + + User Attendances And Absences + hr.attendance.leave + calendar,tree + [('user_id','=',uid)] + + + + + + calendar + + + + + + + tree + + + + + + + + Attendances And Absences + hr.attendance.leave + tree,calendar + + + + + + tree + + + + + + + calendar + + + + + + diff --git a/hr_attendance_leave_report/views/hr_attendance_views.xml b/hr_attendance_leave_report/views/hr_attendance_views.xml new file mode 100644 index 0000000..7eebd6c --- /dev/null +++ b/hr_attendance_leave_report/views/hr_attendance_views.xml @@ -0,0 +1,20 @@ + + + + + + diff --git a/setup/hr_attendance_leave_report/odoo/addons/hr_attendance_leave_report b/setup/hr_attendance_leave_report/odoo/addons/hr_attendance_leave_report new file mode 120000 index 0000000..d313e80 --- /dev/null +++ b/setup/hr_attendance_leave_report/odoo/addons/hr_attendance_leave_report @@ -0,0 +1 @@ +../../../../hr_attendance_leave_report \ No newline at end of file diff --git a/setup/hr_attendance_leave_report/setup.py b/setup/hr_attendance_leave_report/setup.py new file mode 100644 index 0000000..28c57bb --- /dev/null +++ b/setup/hr_attendance_leave_report/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)