Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions hr_holidays_natural_period/README.rst
Original file line number Diff line number Diff line change
@@ -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
=======================
Expand All @@ -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
Expand Down Expand Up @@ -89,6 +85,10 @@ Contributors

- Alexandre D. Díaz

- `PyTech <https://www.pytech.it>`__:

- Simone Rubino <simone.rubino@pytech.it>

Maintainers
-----------

Expand Down
2 changes: 2 additions & 0 deletions hr_holidays_natural_period/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@
- Grupo Isonor \<<https://www.grupoisonor.es>\>

> - Alexandre D. Díaz
- [PyTech](https://www.pytech.it):
- Simone Rubino \<<simone.rubino@pytech.it>\>
33 changes: 16 additions & 17 deletions hr_holidays_natural_period/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>README.rst</title>
<title>Holidays natural period</title>
<style type="text/css">

/*
Expand Down Expand Up @@ -360,21 +360,16 @@
</style>
</head>
<body>
<div class="document">
<div class="document" id="holidays-natural-period">
<h1 class="title">Holidays natural period</h1>


<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
</a>
<div class="section" id="holidays-natural-period">
<h1>Holidays natural period</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:dda11a83aa4d20d953186a497f4937084f66c7722aa05dadf895a174807996a5
!! source digest: sha256:7bec1ed617a3a026d9229f53291aa19063538d3a14892090ab2399eb80c51c91
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/hr-holidays/tree/17.0/hr_holidays_natural_period"><img alt="OCA/hr-holidays" src="https://img.shields.io/badge/github-OCA%2Fhr--holidays-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/hr-holidays-17-0/hr-holidays-17-0-hr_holidays_natural_period"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/hr-holidays&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/hr-holidays/tree/17.0/hr_holidays_natural_period"><img alt="OCA/hr-holidays" src="https://img.shields.io/badge/github-OCA%2Fhr--holidays-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/hr-holidays-17-0/hr-holidays-17-0-hr_holidays_natural_period"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/hr-holidays&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module was written to define natural day and natural day (Half Day)
options in request unit on holidays type.</p>
<p><strong>Table of contents</strong></p>
Expand All @@ -391,7 +386,7 @@ <h1>Holidays natural period</h1>
</ul>
</div>
<div class="section" id="usage">
<h2><a class="toc-backref" href="#toc-entry-1">Usage</a></h2>
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
<p>For using natural period on leaves:</p>
<ol class="arabic simple">
<li>Go to <em>Leaves &gt; Dashboard</em>.</li>
Expand All @@ -405,23 +400,23 @@ <h2><a class="toc-backref" href="#toc-entry-1">Usage</a></h2>
</ol>
</div>
<div class="section" id="bug-tracker">
<h2><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h2>
<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/hr-holidays/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/hr-holidays/issues/new?body=module:%20hr_holidays_natural_period%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h2><a class="toc-backref" href="#toc-entry-3">Credits</a></h2>
<h1><a class="toc-backref" href="#toc-entry-3">Credits</a></h1>
<div class="section" id="authors">
<h3><a class="toc-backref" href="#toc-entry-4">Authors</a></h3>
<h2><a class="toc-backref" href="#toc-entry-4">Authors</a></h2>
<ul class="simple">
<li>Tecnativa</li>
</ul>
</div>
<div class="section" id="contributors">
<h3><a class="toc-backref" href="#toc-entry-5">Contributors</a></h3>
<h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<ul>
<li><p class="first">Tecnativa &lt;<a class="reference external" href="https://www.tecnativa.com">https://www.tecnativa.com</a>&gt;</p>
<blockquote>
Expand All @@ -446,10 +441,15 @@ <h3><a class="toc-backref" href="#toc-entry-5">Contributors</a></h3>
</ul>
</blockquote>
</li>
<li><p class="first"><a class="reference external" href="https://www.pytech.it">PyTech</a>:</p>
<ul class="simple">
<li>Simone Rubino &lt;<a class="reference external" href="mailto:simone.rubino&#64;pytech.it">simone.rubino&#64;pytech.it</a>&gt;</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
<h3><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h3>
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
Expand All @@ -464,6 +464,5 @@ <h3><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h3>
</div>
</div>
</div>
</div>
</body>
</html>
36 changes: 35 additions & 1 deletion hr_holidays_natural_period/tests/test_hr_leave.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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")
Expand Down Expand Up @@ -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):
Expand Down
Loading