-
Notifications
You must be signed in to change notification settings - Fork 23.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] hr_holidays: refactor leave duration
The idea of current date_{from,to} computations is as follows: The user selects the request_date_{from,end} (and optionally request_hour_{from,to} and these inputs are then processed into a date_{to,from}, taking into account the type of leave, the work schedule (resource_calendar) and time zone (since date_{to,from} are saved in UTC while the request_dates are stored in the user's timezone. However, in practice this computation is very messy, resulting in date_{to,from} needing to be specified in all demo data and test cases, even though it should be derived from the request dates. Various superfluous or poorly named methods also exist in this flow (eg _get_start_or_end_from_attendance which really performs a timezone conversion, the logic of which resource calendar to use is scattered across the whole model etc). date_{to,from} are used many times as inputs throughout the code, with code being present te inverse compute request_date_{from,to} from these values. However in reality this is not possible to do consistently. Therefore with this commit, we restore request_date_{from,to} as the sole possible inputs, with date_{from,to} being derived from them. In addition, the timezone and resource calendar are consolidated into their own fields, with a single computation method computing them. task-3081565 Part-of: #119317
- Loading branch information
1 parent
88b55a6
commit 6074d86
Showing
35 changed files
with
762 additions
and
942 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
Oops, something went wrong.