diff --git a/hr_attendance_validation/README.rst b/hr_attendance_validation/README.rst index e9c4e3b0..d3c46fcf 100644 --- a/hr_attendance_validation/README.rst +++ b/hr_attendance_validation/README.rst @@ -7,7 +7,7 @@ Hr Attendance Validation !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:1996ce653eae83ec08b80a71833cd66791b5940ba7b519e5b523c94b05be5cc7 + !! source digest: sha256:2e79147e731da1ca237d66ae8153a50ebcf15571fb74a0bf7b554bfec0d9949c !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png @@ -66,6 +66,9 @@ Configuration * Ensure employee weeks are properly set * Set the leave type to use by generating compensatory hours from attendance review (to be done in hr attendance configuration) +* You can ignore some leaves in validation sheet by ticking the "Ignored in attendance validation" + (for instance it can be useful if you manage employee remote days using hr.leave + in such case you want to ignore those lines) * once all leaves and attendances has been recorded you can generate leave reviews by setting up a cron job running every monday morning to generate the previous week with the following code on `hr.attendance.validation.sheet` model:: diff --git a/hr_attendance_validation/__manifest__.py b/hr_attendance_validation/__manifest__.py index 85e49ffe..f6cbecfe 100644 --- a/hr_attendance_validation/__manifest__.py +++ b/hr_attendance_validation/__manifest__.py @@ -21,6 +21,7 @@ "views/hr_attendance_validation.xml", "views/hr_attendance.xml", "views/res_config_settings_views.xml", + "views/hr_leave_type.xml", "security/ir.model.access.csv", "security/ir.rule.xml", "data/ir_cron.xml", diff --git a/hr_attendance_validation/i18n/fr.po b/hr_attendance_validation/i18n/fr.po index 7dc8a355..d1041214 100644 --- a/hr_attendance_validation/i18n/fr.po +++ b/hr_attendance_validation/i18n/fr.po @@ -245,6 +245,7 @@ msgstr "Calendrier de l'employé." #: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_attendance_validation_sheet__display_name #: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_employee_base__display_name #: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_leave__display_name +#: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_leave_type__display_name #: model:ir.model.fields,field_description:hr_attendance_validation.field_res_config_settings__display_name #: model:ir.model.fields,field_description:hr_attendance_validation.field_resource_calendar__display_name msgid "Display Name" @@ -280,11 +281,17 @@ msgstr "Heures effectuées cette semaine" #: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_attendance_validation_sheet__id #: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_employee_base__id #: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_leave__id +#: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_leave_type__id #: model:ir.model.fields,field_description:hr_attendance_validation.field_res_config_settings__id #: model:ir.model.fields,field_description:hr_attendance_validation.field_resource_calendar__id msgid "ID" msgstr "" +#. module: hr_attendance_validation +#: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_leave_type__ignored_in_attendance_validation +msgid "Ignored In Attendance Validation" +msgstr "Ignoré dans les feuilles de revue de présences" + #. module: hr_attendance_validation #: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_attendance__is_overtime_due msgid "Is overtime due" @@ -295,6 +302,7 @@ msgstr "Heure suplémentaire due" #: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_attendance_validation_sheet____last_update #: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_employee_base____last_update #: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_leave____last_update +#: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_leave_type____last_update #: model:ir.model.fields,field_description:hr_attendance_validation.field_res_config_settings____last_update #: model:ir.model.fields,field_description:hr_attendance_validation.field_resource_calendar____last_update msgid "Last Modified on" @@ -440,6 +448,11 @@ msgstr "" msgid "Time Off" msgstr "Congés" +#. module: hr_attendance_validation +#: model:ir.model,name:hr_attendance_validation.model_hr_leave_type +msgid "Time Off Type" +msgstr "Type de congés" + #. module: hr_attendance_validation #: model:ir.model.fields.selection,name:hr_attendance_validation.selection__hr_attendance_validation_sheet__state__draft #: model_terms:ir.ui.view,arch_db:hr_attendance_validation.hr_attendance_validation_sheet_view_form @@ -528,6 +541,3 @@ msgid "" msgstr "" "Vous avez modifié un paramètre nécessitant de relancer la récupération des " "lignes de présence et congés." - -#~ msgid "Attendance validation sheets" -#~ msgstr "Revue des présences" diff --git a/hr_attendance_validation/i18n/hr_attendance_validation.pot b/hr_attendance_validation/i18n/hr_attendance_validation.pot index 2ed3dcdc..0a688185 100644 --- a/hr_attendance_validation/i18n/hr_attendance_validation.pot +++ b/hr_attendance_validation/i18n/hr_attendance_validation.pot @@ -224,6 +224,7 @@ msgstr "" #: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_attendance_validation_sheet__display_name #: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_employee_base__display_name #: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_leave__display_name +#: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_leave_type__display_name #: model:ir.model.fields,field_description:hr_attendance_validation.field_res_config_settings__display_name #: model:ir.model.fields,field_description:hr_attendance_validation.field_resource_calendar__display_name msgid "Display Name" @@ -259,11 +260,17 @@ msgstr "" #: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_attendance_validation_sheet__id #: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_employee_base__id #: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_leave__id +#: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_leave_type__id #: model:ir.model.fields,field_description:hr_attendance_validation.field_res_config_settings__id #: model:ir.model.fields,field_description:hr_attendance_validation.field_resource_calendar__id msgid "ID" msgstr "" +#. module: hr_attendance_validation +#: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_leave_type__ignored_in_attendance_validation +msgid "Ignored In Attendance Validation" +msgstr "" + #. module: hr_attendance_validation #: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_attendance__is_overtime_due msgid "Is overtime due" @@ -274,6 +281,7 @@ msgstr "" #: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_attendance_validation_sheet____last_update #: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_employee_base____last_update #: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_leave____last_update +#: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_leave_type____last_update #: model:ir.model.fields,field_description:hr_attendance_validation.field_res_config_settings____last_update #: model:ir.model.fields,field_description:hr_attendance_validation.field_resource_calendar____last_update msgid "Last Modified on" @@ -416,6 +424,11 @@ msgstr "" msgid "Time Off" msgstr "" +#. module: hr_attendance_validation +#: model:ir.model,name:hr_attendance_validation.model_hr_leave_type +msgid "Time Off Type" +msgstr "" + #. module: hr_attendance_validation #: model:ir.model.fields.selection,name:hr_attendance_validation.selection__hr_attendance_validation_sheet__state__draft #: model_terms:ir.ui.view,arch_db:hr_attendance_validation.hr_attendance_validation_sheet_view_form diff --git a/hr_attendance_validation/i18n/it.po b/hr_attendance_validation/i18n/it.po index 7a732c57..8007027c 100644 --- a/hr_attendance_validation/i18n/it.po +++ b/hr_attendance_validation/i18n/it.po @@ -245,6 +245,7 @@ msgstr "Definire la schedulazione della risorsa" #: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_attendance_validation_sheet__display_name #: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_employee_base__display_name #: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_leave__display_name +#: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_leave_type__display_name #: model:ir.model.fields,field_description:hr_attendance_validation.field_res_config_settings__display_name #: model:ir.model.fields,field_description:hr_attendance_validation.field_resource_calendar__display_name msgid "Display Name" @@ -280,11 +281,17 @@ msgstr "Ore settimana corrente" #: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_attendance_validation_sheet__id #: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_employee_base__id #: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_leave__id +#: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_leave_type__id #: model:ir.model.fields,field_description:hr_attendance_validation.field_res_config_settings__id #: model:ir.model.fields,field_description:hr_attendance_validation.field_resource_calendar__id msgid "ID" msgstr "ID" +#. module: hr_attendance_validation +#: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_leave_type__ignored_in_attendance_validation +msgid "Ignored In Attendance Validation" +msgstr "" + #. module: hr_attendance_validation #: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_attendance__is_overtime_due msgid "Is overtime due" @@ -295,6 +302,7 @@ msgstr "Straordinario dovuto" #: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_attendance_validation_sheet____last_update #: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_employee_base____last_update #: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_leave____last_update +#: model:ir.model.fields,field_description:hr_attendance_validation.field_hr_leave_type____last_update #: model:ir.model.fields,field_description:hr_attendance_validation.field_res_config_settings____last_update #: model:ir.model.fields,field_description:hr_attendance_validation.field_resource_calendar____last_update msgid "Last Modified on" @@ -439,6 +447,11 @@ msgstr "" msgid "Time Off" msgstr "Ferie" +#. module: hr_attendance_validation +#: model:ir.model,name:hr_attendance_validation.model_hr_leave_type +msgid "Time Off Type" +msgstr "" + #. module: hr_attendance_validation #: model:ir.model.fields.selection,name:hr_attendance_validation.selection__hr_attendance_validation_sheet__state__draft #: model_terms:ir.ui.view,arch_db:hr_attendance_validation.hr_attendance_validation_sheet_view_form @@ -523,6 +536,3 @@ msgid "" msgstr "" "È cambiato il dipendente e/o data: bisogna recuperare le presenze e\n" " permessi per queste nuove impostazioni." - -#~ msgid "Attendance validation sheets" -#~ msgstr "Prospetti validazione presenza" diff --git a/hr_attendance_validation/models/__init__.py b/hr_attendance_validation/models/__init__.py index 15783df2..b059e291 100644 --- a/hr_attendance_validation/models/__init__.py +++ b/hr_attendance_validation/models/__init__.py @@ -1,5 +1,6 @@ from . import hr_attendance from . import hr_leave +from . import hr_leave_type from . import hr_attendance_validation_sheet from . import hr_employee from . import resource_calendar diff --git a/hr_attendance_validation/models/hr_attendance_validation_sheet.py b/hr_attendance_validation/models/hr_attendance_validation_sheet.py index da8f4c82..40085e20 100644 --- a/hr_attendance_validation/models/hr_attendance_validation_sheet.py +++ b/hr_attendance_validation/models/hr_attendance_validation_sheet.py @@ -213,6 +213,11 @@ def _retrieve_leave(self): [ ("state", "in", ["validate", "validate1"]), ("employee_id", "=", record.employee_id.id), + ( + "holiday_status_id.ignored_in_attendance_validation", + "=", + False, + ), ], expression.OR( [ diff --git a/hr_attendance_validation/models/hr_leave_type.py b/hr_attendance_validation/models/hr_leave_type.py new file mode 100644 index 00000000..ca426b43 --- /dev/null +++ b/hr_attendance_validation/models/hr_leave_type.py @@ -0,0 +1,9 @@ +# Copyright 2023 Pierre Verkest +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html +from odoo import fields, models + + +class HrLeaveType(models.Model): + _inherit = "hr.leave.type" + + ignored_in_attendance_validation = fields.Boolean() diff --git a/hr_attendance_validation/readme/CONFIGURE.rst b/hr_attendance_validation/readme/CONFIGURE.rst index 999e8f2a..a21b9b10 100644 --- a/hr_attendance_validation/readme/CONFIGURE.rst +++ b/hr_attendance_validation/readme/CONFIGURE.rst @@ -1,6 +1,9 @@ * Ensure employee weeks are properly set * Set the leave type to use by generating compensatory hours from attendance review (to be done in hr attendance configuration) +* You can ignore some leaves in validation sheet by ticking the "Ignored in attendance validation" + (for instance it can be useful if you manage employee remote days using hr.leave + in such case you want to ignore those lines) * once all leaves and attendances has been recorded you can generate leave reviews by setting up a cron job running every monday morning to generate the previous week with the following code on `hr.attendance.validation.sheet` model:: diff --git a/hr_attendance_validation/static/description/index.html b/hr_attendance_validation/static/description/index.html index bf6286eb..492ad8e4 100644 --- a/hr_attendance_validation/static/description/index.html +++ b/hr_attendance_validation/static/description/index.html @@ -367,7 +367,7 @@

Hr Attendance Validation

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:1996ce653eae83ec08b80a71833cd66791b5940ba7b519e5b523c94b05be5cc7 +!! source digest: sha256:2e79147e731da1ca237d66ae8153a50ebcf15571fb74a0bf7b554bfec0d9949c !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Beta License: AGPL-3 OCA/hr-attendance Translate me on Weblate Try me on Runboat

This add a validation mechanism to review employee attendance @@ -415,6 +415,10 @@

Configuration

  • Set the leave type to use by generating compensatory hours from attendance review (to be done in hr attendance configuration)

  • +
  • You can ignore some leaves in validation sheet by ticking the “Ignored in attendance validation” +(for instance it can be useful if you manage employee remote days using hr.leave +in such case you want to ignore those lines)

    +
  • once all leaves and attendances has been recorded you can generate leave reviews by setting up a cron job running every monday morning to generate the previous week with the following code on hr.attendance.validation.sheet model:

    diff --git a/hr_attendance_validation/tests/test_hr_attendance_validation.py b/hr_attendance_validation/tests/test_hr_attendance_validation.py index e2db186e..039c31e5 100644 --- a/hr_attendance_validation/tests/test_hr_attendance_validation.py +++ b/hr_attendance_validation/tests/test_hr_attendance_validation.py @@ -91,6 +91,29 @@ def setup_employee_holidays(self): ) self.empl_leave_comp.action_validate() + def setup_employee_remote_days(self): + self.env["hr.leave.allocation"].create( + { + "employee_id": self.employee.id, + "holiday_status_id": self.leave_remote.id, + "number_of_days": 5, + "holiday_type": "employee", + "state": "validate", + "name": "5 days - Remote days", + } + ) + self.empl_remote = self.env["hr.leave"].create( + { + "employee_id": self.employee.id, + "holiday_status_id": self.leave_remote.id, + # overlap two weeks + "request_date_from": "2021-12-09", + "request_date_to": "2021-12-10", + "number_of_days": 1, + } + ) + self.empl_remote.action_validate() + def setup_employee_attendances(self): self.env["hr.attendance"].create( [ @@ -149,9 +172,22 @@ def setUp(self): self.HrAttendanceValidation = self.env["hr.attendance.validation.sheet"] self.leave_cl = self.env.ref("hr_holidays.holiday_status_cl") self.leave_comp = self.env.ref("hr_holidays.holiday_status_comp") + self.leave_remote = self.env["hr.leave.type"].create( + { + "name": "Remote test", + "code": "REM1", + "request_unit": "half_day", + "color_name": "blue", + "allocation_type": "fixed", + "leave_validation_type": "no_validation", + "create_calendar_meeting": True, + "ignored_in_attendance_validation": True, + } + ) self.setup_employee() self.setup_employee_allocation() self.setup_employee_holidays() + self.setup_employee_remote_days() self.setup_employee_attendances() def test_name_get_missing_employee(self): diff --git a/hr_attendance_validation/views/hr_leave_type.xml b/hr_attendance_validation/views/hr_leave_type.xml new file mode 100644 index 00000000..ae8c4552 --- /dev/null +++ b/hr_attendance_validation/views/hr_leave_type.xml @@ -0,0 +1,19 @@ + + + + + + hr.leave.type.form + hr.leave.type + + + + + + + +