diff --git a/hr_holidays_natural_period/README.rst b/hr_holidays_natural_period/README.rst index 183f5b656..3e39f8e1e 100644 --- a/hr_holidays_natural_period/README.rst +++ b/hr_holidays_natural_period/README.rst @@ -1,7 +1,3 @@ -.. image:: https://odoo-community.org/readme-banner-image - :target: https://odoo-community.org/get-involved?utm_source=readme - :alt: Odoo Community Association - ======================= Holidays natural period ======================= @@ -11,13 +7,13 @@ Holidays natural period !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:dda11a83aa4d20d953186a497f4937084f66c7722aa05dadf895a174807996a5 + !! source digest: sha256:7bec1ed617a3a026d9229f53291aa19063538d3a14892090ab2399eb80c51c91 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png :target: https://odoo-community.org/page/development-status :alt: Beta -.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fhr--holidays-lightgray.png?logo=github @@ -89,6 +85,10 @@ Contributors - Alexandre D. Díaz +- `PyTech `__: + + - Simone Rubino + Maintainers ----------- diff --git a/hr_holidays_natural_period/readme/CONTRIBUTORS.md b/hr_holidays_natural_period/readme/CONTRIBUTORS.md index 1afc02824..2043590e0 100644 --- a/hr_holidays_natural_period/readme/CONTRIBUTORS.md +++ b/hr_holidays_natural_period/readme/CONTRIBUTORS.md @@ -11,3 +11,5 @@ - Grupo Isonor \<\> > - Alexandre D. Díaz +- [PyTech](https://www.pytech.it): + - Simone Rubino \<\> diff --git a/hr_holidays_natural_period/static/description/index.html b/hr_holidays_natural_period/static/description/index.html index aa59ecd54..133ee8535 100644 --- a/hr_holidays_natural_period/static/description/index.html +++ b/hr_holidays_natural_period/static/description/index.html @@ -3,7 +3,7 @@ -README.rst +Holidays natural period -
+
+

Holidays natural period

- - -Odoo Community Association - -
-

Holidays natural period

-

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

+

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

This module was written to define natural day and natural day (Half Day) options in request unit on holidays type.

Table of contents

@@ -391,7 +386,7 @@

Holidays natural period

-

Usage

+

Usage

For using natural period on leaves:

  1. Go to Leaves > Dashboard.
  2. @@ -405,7 +400,7 @@

    Usage

-

Bug Tracker

+

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 to smash it by providing a detailed and welcomed @@ -413,15 +408,15 @@

Bug Tracker

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

-

Credits

+

Credits

-

Authors

+

Authors

  • Tecnativa
-

Contributors

+

Contributors

+
  • PyTech:

    + +
  • -

    Maintainers

    +

    Maintainers

    This module is maintained by the OCA.

    Odoo Community Association @@ -464,6 +464,5 @@

    Maintainers

    -
    diff --git a/hr_holidays_natural_period/tests/test_hr_leave.py b/hr_holidays_natural_period/tests/test_hr_leave.py index d022e5aef..aea8c5999 100644 --- a/hr_holidays_natural_period/tests/test_hr_leave.py +++ b/hr_holidays_natural_period/tests/test_hr_leave.py @@ -1,5 +1,7 @@ # Copyright 2020-2025 Tecnativa - Víctor Martínez +# Copyright 2026 Simone Rubino - PyTech # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + from odoo import fields from odoo.tests import Form, new_test_user from odoo.tests.common import users @@ -14,6 +16,13 @@ def setUpClass(cls): cls.leave_type = cls.env.ref( "hr_holidays_natural_period.hr_leave_type_natural_day_test" ) + cls.no_validation_leave_type = cls.leave_type.copy( + default={ + "name": "Test no validation leave type", + "requires_allocation": "no", + "leave_validation_type": "no_validation", + }, + ) cls.leave_type_day = cls.env.ref("hr_holidays.holiday_status_cl") cls.leave_type_day.employee_requests = "yes" calendar = cls.env.ref("resource.resource_calendar_std") @@ -142,7 +151,32 @@ def test_hr_leave_natural_day_half_day_02(self): self._test_hr_leave_natural_day_02() leave = self._create_hr_leave(self.leave_type, "2022-12-31", "2023-01-08") self.assertEqual(leave.number_of_days, 0.5) - self.assertEqual(leave.number_of_days_display, 0.5) + + @users("test-user") + def test_hr_leave_natural_day_no_manager(self): + """An employee that is not a manager + can create a natural day leave + in the future with no validation. + """ + # Arrange + leave_type = self.no_validation_leave_type + manager_groups = [ + self.env.ref("hr.group_hr_user"), + self.env.ref("hr.group_hr_manager"), + self.env.ref("hr_holidays.group_hr_holidays_user"), + self.env.ref("hr_holidays.group_hr_holidays_responsible"), + self.env.ref("hr_holidays.group_hr_holidays_manager"), + ] + # pre-condition + self.assertEqual(leave_type.leave_validation_type, "no_validation") + for manager_group in manager_groups: + self.assertNotIn(manager_group, self.env.user.groups_id) + + # Act + leave = self._create_hr_leave(leave_type, "3000-01-01", "3000-01-01") + + # Assert + self.assertEqual(leave.state, "validate") @users("test-user") def test_hr_leave_day(self):