diff --git a/hr_leave_custom_hour_interval/README.rst b/hr_leave_custom_hour_interval/README.rst index ceed8cce..0c6be613 100644 --- a/hr_leave_custom_hour_interval/README.rst +++ b/hr_leave_custom_hour_interval/README.rst @@ -17,13 +17,13 @@ Custom Hour Interval for Holidays :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 - :target: https://github.com/OCA/hr-holidays/tree/15.0/hr_leave_custom_hour_interval + :target: https://github.com/OCA/hr-holidays/tree/16.0/hr_leave_custom_hour_interval :alt: OCA/hr-holidays .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/hr-holidays-15-0/hr-holidays-15-0-hr_leave_custom_hour_interval + :target: https://translation.odoo-community.org/projects/hr-holidays-16-0/hr-holidays-16-0-hr_leave_custom_hour_interval :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/hr-holidays&target_branch=15.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/hr-holidays&target_branch=16.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -35,15 +35,22 @@ This module allows to create time off requests using custom hours with float fie .. contents:: :local: +Configuration +============= + +To configure the module in order to use the custom hours with float fields, you need to: + +1. Go to Time Off > Configuration > Time Off Types +2. Create a "Hours Time Off" Time Off Type and set "Take Time Off in" field to "Hours". + Usage ===== To use this module, you need to: -#. Go to Time Off > Configuration > Time Off Types -#. Create a "Hours Time Off" Time Off Type and select "Custom Hours" -#. Go to My Time Off > Time Off Requests -#. Create a Time Off Request with the Time Off Type previously created +#. Go to Time Off > My Time Off > My Time Off +#. Create a Time Off Request with the Time Off Type previously created and set "Custom Hours" check box. +#. Set the custom hours in the fields that will appear below the setted check box. Bug Tracker =========== @@ -51,7 +58,7 @@ 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 -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -83,6 +90,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -This module is part of the `OCA/hr-holidays `_ project on GitHub. +This module is part of the `OCA/hr-holidays `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/hr_leave_custom_hour_interval/__manifest__.py b/hr_leave_custom_hour_interval/__manifest__.py index 47d77f63..df8414da 100644 --- a/hr_leave_custom_hour_interval/__manifest__.py +++ b/hr_leave_custom_hour_interval/__manifest__.py @@ -5,7 +5,7 @@ "name": "Custom Hour Interval for Holidays", "summary": """ Edit start and end of leaves using time intervals""", - "version": "15.0.1.0.0", + "version": "16.0.1.0.0", "license": "AGPL-3", "author": "Creu Blanca,Odoo Community Association (OCA)", "website": "https://github.com/OCA/hr-holidays", diff --git a/hr_leave_custom_hour_interval/readme/CONFIGURE.rst b/hr_leave_custom_hour_interval/readme/CONFIGURE.rst new file mode 100644 index 00000000..24f819cc --- /dev/null +++ b/hr_leave_custom_hour_interval/readme/CONFIGURE.rst @@ -0,0 +1,4 @@ +To configure the module in order to use the custom hours with float fields, you need to: + +1. Go to Time Off > Configuration > Time Off Types +2. Create a "Hours Time Off" Time Off Type and set "Take Time Off in" field to "Hours". diff --git a/hr_leave_custom_hour_interval/readme/USAGE.rst b/hr_leave_custom_hour_interval/readme/USAGE.rst index ce544091..6d34ba62 100644 --- a/hr_leave_custom_hour_interval/readme/USAGE.rst +++ b/hr_leave_custom_hour_interval/readme/USAGE.rst @@ -1,6 +1,5 @@ To use this module, you need to: -#. Go to Time Off > Configuration > Time Off Types -#. Create a "Hours Time Off" Time Off Type and select "Custom Hours" -#. Go to My Time Off > Time Off Requests -#. Create a Time Off Request with the Time Off Type previously created +#. Go to Time Off > My Time Off > My Time Off +#. Create a Time Off Request with the Time Off Type previously created and set "Custom Hours" check box. +#. Set the custom hours in the fields that will appear below the setted check box. diff --git a/hr_leave_custom_hour_interval/static/description/index.html b/hr_leave_custom_hour_interval/static/description/index.html index c93d1e6d..167c412b 100644 --- a/hr_leave_custom_hour_interval/static/description/index.html +++ b/hr_leave_custom_hour_interval/static/description/index.html @@ -1,4 +1,3 @@ - @@ -369,49 +368,57 @@

Custom Hour Interval for Holidays

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:a84caeece078676af0eb42ef9a6088ad699fd9ad42e802512c6ff75083afb7f0 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

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 allows to create time off requests using custom hours with float fields.

Table of contents

+
+

Configuration

+

To configure the module in order to use the custom hours with float fields, you need to:

+
    +
  1. Go to Time Off > Configuration > Time Off Types
  2. +
  3. Create a “Hours Time Off” Time Off Type and set “Take Time Off in” field to “Hours”.
  4. +
+
-

Usage

+

Usage

To use this module, you need to:

    -
  1. Go to Time Off > Configuration > Time Off Types
  2. -
  3. Create a “Hours Time Off” Time Off Type and select “Custom Hours”
  4. -
  5. Go to My Time Off > Time Off Requests
  6. -
  7. Create a Time Off Request with the Time Off Type previously created
  8. +
  9. Go to Time Off > My Time Off > My Time Off
  10. +
  11. Create a Time Off Request with the Time Off Type previously created and set “Custom Hours” check box.
  12. +
  13. Set the custom hours in the fields that will appear below the setted check box.
-

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 -feedback.

+feedback.

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

-

Credits

+

Credits

-

Authors

+

Authors

  • Creu Blanca
-

Contributors

+

Contributors

-

Maintainers

+

Maintainers

This module is maintained by the OCA.

Odoo Community Association

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

-

This module is part of the OCA/hr-holidays project on GitHub.

+

This module is part of the OCA/hr-holidays project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

diff --git a/hr_leave_custom_hour_interval/tests/__init__.py b/hr_leave_custom_hour_interval/tests/__init__.py new file mode 100644 index 00000000..4752aaf0 --- /dev/null +++ b/hr_leave_custom_hour_interval/tests/__init__.py @@ -0,0 +1 @@ +from . import test_hr_leave diff --git a/hr_leave_custom_hour_interval/tests/test_hr_leave.py b/hr_leave_custom_hour_interval/tests/test_hr_leave.py new file mode 100644 index 00000000..406d84f0 --- /dev/null +++ b/hr_leave_custom_hour_interval/tests/test_hr_leave.py @@ -0,0 +1,40 @@ +from odoo.tests.common import TransactionCase + + +class TestHrLeave(TransactionCase): + def setUp(self): + super().setUp() + self.hr_leave_type = self.env["hr.leave.type"].create( + { + "name": "Test Leave Type", + "leave_validation_type": "manager", + "requires_allocation": "no", + "request_unit": "hour", + "time_type": "leave", + } + ) + + self.employee = self.env["hr.employee"].create( + { + "name": "Test Employee", + } + ) + + self.HrLeave = self.env["hr.leave"] + + def test_compute_custom_hours(self): + hr_leave = self.HrLeave.create( + { + "holiday_type": "employee", + "employee_id": self.employee.id, + "holiday_status_id": self.hr_leave_type.id, + "request_unit_hours": True, + "request_date_from": "2024-07-01", + "request_time_hour_from": 10.0, + "request_time_hour_to": 10.5, + } + ) + + hr_leave._compute_date_from_to() + + self.assertEqual(hr_leave.number_of_hours_display, 0.5)