-
-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] hr_leave_custom_hour_interval: Migration to 16.0
- Loading branch information
1 parent
776b5dc
commit edc1aa1
Showing
8 changed files
with
94 additions
and
36 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
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
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
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,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". |
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 |
---|---|---|
@@ -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. |
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
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 @@ | ||
from . import test_hr_leave |
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,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) |