-
Notifications
You must be signed in to change notification settings - Fork 30.2k
[FIX] hr, hr_holidays, resource: fix flexible resource leave in planning gantt #198032
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FIX] hr, hr_holidays, resource: fix flexible resource leave in planning gantt #198032
Conversation
1f7aef1 to
2191951
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your work, I left some comments but I have not tested it yet.
db83eff to
8ae2004
Compare
8ae2004 to
e3cfdaa
Compare
e3cfdaa to
3b9fb40
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small review + incoming commit
4459be1 to
fddcf72
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your work, I left one comment. 🙂
616b6e8 to
3aa0b8f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably ensure having at most one record, otherwise this will crash
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prout
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review @Bertrand2 , I added self.ensure_one() to ensure the behavior you suggested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind, adding ensure_one broke on multiple places since the method was called from an empty self (by calling the class self.env['resource.calendar']._get_attendance_intervals_days_data(...), I opted to add len(self) == 1 on the line itself.
3aa0b8f to
c02b449
Compare
Prior to this commit, flexible resources did not have their leaves reflected as gray cells in the planning gantt view. This was due to the work_intervals being ignored for the calculation of flexible resources availability. This commit adds measures to handle the leaves for flexible resources by setting a dummy attendance (which covers the whole length of the period in gantt interval), and then injects their leaves interval. To replicate: 1. set a timeoff to a flexible resource 2. open planning app 3. in the gantt view, the day in which the timeoff was set should be grayed. ticket-id: 4492625 enterprise: 79532
…ing wrong arg Prior to this test, calendar attendance_intervals_batch was getting resources records of type 'resource.test' when it is expected to get 'resource.resource' as its argument. This fix was introduced with the changes introduced in attendarce_intervals to adapt to the creation of dummy attendance interval for flexible resources in the task below. related-task: 4492625
…_schedule This commit aims to fix the issue where the _get_schedule method of the hr.calendar model was receiving a list of employee ids instead of a list of resource objects, leading to some test failures as '_is_flexible' method was not accessible from the employee object that was initially passed. Additionally, the _get_schedule method in res_partner was passing employee_id instead of the employee's resource_id to fetch the calendar_intervals. This was also fixed in this commit. related ticket-id: 4492625 enterprise: 79532
Prior to this commit, _get_calendars used to return the company default working calendar for fully flexible resources (ones without a calendar). This lead to _get_attendance_intervals_days_data to fail to fetch duration_days and duration_hours for such resources, leading to zero division. Additionally, _get_leave_days_data_batch is adapted to handle fully flexible resources by returning days and hours of the whole period without leaves take into account (as we currently do not support leaves for fully flexible).
c02b449 to
3e2bca3
Compare
|
robodoo r+ rebase-ff |
|
Merge method set to rebase and fast-forward. |
Prior to this commit, flexible resources did not have their leaves reflected as gray cells in the planning gantt view. This was due to the work_intervals being ignored for the calculation of flexible resources availability. This commit adds measures to handle the leaves for flexible resources by setting a dummy attendance (which covers the whole length of the period in gantt interval), and then injects their leaves interval. To replicate: 1. set a timeoff to a flexible resource 2. open planning app 3. in the gantt view, the day in which the timeoff was set should be grayed. Ticket-id: 4492625 Enterprise: 79532 Part-of: #198032 Related: odoo/enterprise#79532 Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
…ing wrong arg Prior to this test, calendar attendance_intervals_batch was getting resources records of type 'resource.test' when it is expected to get 'resource.resource' as its argument. This fix was introduced with the changes introduced in attendarce_intervals to adapt to the creation of dummy attendance interval for flexible resources in the task below. Related-task: 4492625 Part-of: #198032 Related: odoo/enterprise#79532 Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
…_schedule This commit aims to fix the issue where the _get_schedule method of the hr.calendar model was receiving a list of employee ids instead of a list of resource objects, leading to some test failures as '_is_flexible' method was not accessible from the employee object that was initially passed. Additionally, the _get_schedule method in res_partner was passing employee_id instead of the employee's resource_id to fetch the calendar_intervals. This was also fixed in this commit. related ticket-id: 4492625 Enterprise: 79532 Part-of: #198032 Related: odoo/enterprise#79532 Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
Prior to this commit, flexible resources did not have their leaves reflected as gray cells in the planning gantt view. This was due to the work_intervals being ignored for the calculation of flexible resources availability. This commit adds measures to handle the leaves for flexible resources by setting a dummy attendance (which covers the whole length of the period in gantt interval), and then injects their leaves interval. To replicate: 1. set a timeoff to a flexible resource 2. open planning app 3. in the gantt view, the day in which the timeoff was set should be grayed. Ticket-id: 4492625 Enterprise: 79532 Part-of: odoo#198032 Related: odoo/enterprise#79532 Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
…ing wrong arg Prior to this test, calendar attendance_intervals_batch was getting resources records of type 'resource.test' when it is expected to get 'resource.resource' as its argument. This fix was introduced with the changes introduced in attendarce_intervals to adapt to the creation of dummy attendance interval for flexible resources in the task below. Related-task: 4492625 Part-of: odoo#198032 Related: odoo/enterprise#79532 Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
…_schedule This commit aims to fix the issue where the _get_schedule method of the hr.calendar model was receiving a list of employee ids instead of a list of resource objects, leading to some test failures as '_is_flexible' method was not accessible from the employee object that was initially passed. Additionally, the _get_schedule method in res_partner was passing employee_id instead of the employee's resource_id to fetch the calendar_intervals. This was also fixed in this commit. related ticket-id: 4492625 Enterprise: 79532 Part-of: odoo#198032 Related: odoo/enterprise#79532 Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
Prior to this commit, _get_calendars used to return the company default working calendar for fully flexible resources (ones without a calendar). This lead to _get_attendance_intervals_days_data to fail to fetch duration_days and duration_hours for such resources, leading to zero division. Additionally, _get_leave_days_data_batch is adapted to handle fully flexible resources by returning days and hours of the whole period without leaves take into account (as we currently do not support leaves for fully flexible). closes odoo#198032 Related: odoo/enterprise#79532 Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
Prior to this commit, flexible resources did not have their leaves reflected as gray cells in the planning gantt view. This was due to the work_intervals being ignored for the calculation of flexible resources availability. This commit adds measures to handle the leaves for flexible resources by setting a dummy attendance (which covers the whole length of the period in gantt interval), and then injects their leaves interval. To replicate: 1. set a timeoff to a flexible resource 2. open planning app 3. in the gantt view, the day in which the timeoff was set should be grayed. Ticket-id: 4492625 Enterprise: 79532 Part-of: odoo/odoo#198032 Related: odoo/enterprise#79532 Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
…ing wrong arg Prior to this test, calendar attendance_intervals_batch was getting resources records of type 'resource.test' when it is expected to get 'resource.resource' as its argument. This fix was introduced with the changes introduced in attendarce_intervals to adapt to the creation of dummy attendance interval for flexible resources in the task below. Related-task: 4492625 Part-of: odoo/odoo#198032 Related: odoo/enterprise#79532 Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
…_schedule This commit aims to fix the issue where the _get_schedule method of the hr.calendar model was receiving a list of employee ids instead of a list of resource objects, leading to some test failures as '_is_flexible' method was not accessible from the employee object that was initially passed. Additionally, the _get_schedule method in res_partner was passing employee_id instead of the employee's resource_id to fetch the calendar_intervals. This was also fixed in this commit. related ticket-id: 4492625 Enterprise: 79532 Part-of: odoo/odoo#198032 Related: odoo/enterprise#79532 Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
Prior to this commit, _get_calendars used to return the company default working calendar for fully flexible resources (ones without a calendar). This lead to _get_attendance_intervals_days_data to fail to fetch duration_days and duration_hours for such resources, leading to zero division. Additionally, _get_leave_days_data_batch is adapted to handle fully flexible resources by returning days and hours of the whole period without leaves take into account (as we currently do not support leaves for fully flexible). closes odoo/odoo#198032 Related: odoo/enterprise#79532 Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>

Prior to this commit, flexible resources did not have their leaves reflected as gray cells in the planning gantt view. This was due to the work_intervals being ignored for the calculation of flexible resources availability.
This commit adds measures to handle the leaves for flexible resources by setting a dummy attendance (which covers the whole length of the period in gantt interval), and then injects their leaves interval.
To replicate:
ticket-id: 4492625
enterprise: 79532
Description of the issue/feature this PR addresses:
Current behavior before PR:
Desired behavior after PR is merged:
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr