-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[16.0][ADD] hr_attendance_leave_report: In Attendances new menu optio…
…n: "Attendances And Leaves".
- Loading branch information
1 parent
a8e8f42
commit e6a214b
Showing
22 changed files
with
2,191 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
.. 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 | ||
========================== | ||
|
||
* In Attendances new menu option: "Attendances And Leaves". | ||
* 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. | ||
* New scheduled action: "Put festives in Attendances and absences report", | ||
to put the absence and holiday that corresponds to the day the planner is | ||
executed. | ||
|
||
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]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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": ["resource", "hr_attendance", "hr_holidays"], | ||
"data": [ | ||
"security/ir.model.access.csv", | ||
"security/hr_attendance_leave_report_security.xml", | ||
"data/scheduled_action.xml", | ||
"views/hr_attendance_leave_views.xml", | ||
], | ||
"installable": True, | ||
"post_init_hook": "_post_install_put_dates_without_hour", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# 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, from_unlink=None | ||
): | ||
if from_unlink is None: | ||
from_unlink = False | ||
date_from = date_from | ||
date_to = date_to | ||
while date_from <= date_to: | ||
if from_unlink or date_from <= today_date: | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
<record id="ir_cron_festives_to_hr_attendance_leave_report" model="ir.cron"> | ||
<field name="name">Put festives in Attendances and absences report</field> | ||
<field name="interval_number">1</field> | ||
<field name="interval_type">days</field> | ||
<field name="numbercall">-1</field> | ||
<field | ||
name="nextcall" | ||
eval="(DateTime.now().replace(hour=0, minute=30) + timedelta(days=1)).strftime('%Y-%m-%d %H:%M:%S')" | ||
/> | ||
<field name="doall" eval="False" /> | ||
<field name="model_id" ref="model_hr_attendance_leave" /> | ||
<field name="code">model._put_festives_attendances_absences()</field> | ||
<field name="state">code</field> | ||
</record> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,258 @@ | ||
# 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-08 07:15+0000\n" | ||
"PO-Revision-Date: 2024-10-08 07:15+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_attendance_report_from_leave_report | ||
msgid "Attendance Analysis" | ||
msgstr "" | ||
|
||
#. module: hr_attendance_leave_report | ||
#: model:ir.actions.act_window,name:hr_attendance_leave_report.action_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 | ||
msgid "Attendances And Leaves" | ||
msgstr "" | ||
|
||
#. module: hr_attendance_leave_report | ||
#: model:ir.model,name:hr_attendance_leave_report.model_hr_attendance_leave | ||
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 | ||
#: model:ir.model.fields,field_description:hr_attendance_leave_report.field_hr_attendance__check_out_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_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 | ||
#, python-format | ||
msgid "Normal Day" | ||
msgstr "" | ||
|
||
#. module: hr_attendance_leave_report | ||
#: model:ir.actions.server,name:hr_attendance_leave_report.ir_cron_festives_to_hr_attendance_leave_report_ir_actions_server | ||
#: model:ir.cron,cron_name:hr_attendance_leave_report.ir_cron_festives_to_hr_attendance_leave_report | ||
msgid "Put festives in Attendances and absences report" | ||
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 Leaves" | ||
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.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 "" |
Oops, something went wrong.