Skip to content

Conversation

@SaraBriki
Copy link

Steps to Reproduce

  • Go to Time Off > Management > Time Off
  • Create a Time Off for an employee with empty "Working Hours" (Payroll tab on profile).
  • Ensure the Time Off Type has "Requires allocation" unchecked so it appears in the dropdown.
  • Save and then try to Validate.

Issue

During validation, _validate_leave_request assumes the employee has a working calendar and tries to access calendar.tz. When "Working Hours" is empty, resource_calendar_id is False, leading to the traceback.

Fix

Skip timesheet generation and upper bound check when the employee has no working calendar (fully flexible case).

task-5048761

@robodoo
Copy link
Contributor

robodoo commented Aug 29, 2025

Pull request status dashboard

@C3POdoo C3POdoo requested a review from a team August 29, 2025 10:00
Copy link
Contributor

@Einar-eian Einar-eian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your work, LGTM 🚀

@SaraBriki SaraBriki force-pushed the master-fix_traceback_on_validate_leave_for_fully_flexible_employee-brsa branch from f46d40b to a8d4bd9 Compare September 26, 2025 08:49
Reproduce:
- Go to Time Off > Management > Time Off
- Create a Time Off for an employee with empty "Working Hours"
  (Payroll tab on profile).
- Ensure the Time Off Type has "Requires allocation" unchecked so it
  appears in the dropdown.
- Save and then try to Validate.

Issue:
During validation, `_validate_leave_request` assumes the employee has a
working calendar and tries to access `calendar.tz`. When "Working Hours"
is empty, `resource_calendar_id` is False, leading to the traceback.

Fix:
Skip timesheet generation and upper bound check when the employee has no working
calendar (fully flexible case). A placeholder "Flexible" was also added to
the `hr.employee` form view on the field "Working Hours" when empty.

task-5048761
@SaraBriki SaraBriki force-pushed the master-fix_traceback_on_validate_leave_for_fully_flexible_employee-brsa branch from a8d4bd9 to f8bc29b Compare October 6, 2025 16:06
Copy link
Contributor

@xavierbol xavierbol left a 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. 🙂

@SaraBriki SaraBriki requested a review from xavierbol October 9, 2025 09:30
@tivisse
Copy link
Contributor

tivisse commented Oct 30, 2025

@robodoo r+

robodoo pushed a commit that referenced this pull request Oct 30, 2025
Reproduce:
- Go to Time Off > Management > Time Off
- Create a Time Off for an employee with empty "Working Hours"
  (Payroll tab on profile).
- Ensure the Time Off Type has "Requires allocation" unchecked so it
  appears in the dropdown.
- Save and then try to Validate.

Issue:
During validation, `_validate_leave_request` assumes the employee has a
working calendar and tries to access `calendar.tz`. When "Working Hours"
is empty, `resource_calendar_id` is False, leading to the traceback.

Fix:
Skip timesheet generation and upper bound check when the employee has no working
calendar (fully flexible case). A placeholder "Flexible" was also added to
the `hr.employee` form view on the field "Working Hours" when empty.

task-5048761

closes #224769

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
robodoo pushed a commit that referenced this pull request Oct 30, 2025
Reproduce:
- Go to Time Off > Management > Time Off
- Create a Time Off for an employee with empty "Working Hours"
  (Payroll tab on profile).
- Ensure the Time Off Type has "Requires allocation" unchecked so it
  appears in the dropdown.
- Save and then try to Validate.

Issue:
During validation, `_validate_leave_request` assumes the employee has a
working calendar and tries to access `calendar.tz`. When "Working Hours"
is empty, `resource_calendar_id` is False, leading to the traceback.

Fix:
Skip timesheet generation and upper bound check when the employee has no working
calendar (fully flexible case). A placeholder "Flexible" was also added to
the `hr.employee` form view on the field "Working Hours" when empty.

task-5048761

closes #224769

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
robodoo pushed a commit that referenced this pull request Oct 30, 2025
Reproduce:
- Go to Time Off > Management > Time Off
- Create a Time Off for an employee with empty "Working Hours"
  (Payroll tab on profile).
- Ensure the Time Off Type has "Requires allocation" unchecked so it
  appears in the dropdown.
- Save and then try to Validate.

Issue:
During validation, `_validate_leave_request` assumes the employee has a
working calendar and tries to access `calendar.tz`. When "Working Hours"
is empty, `resource_calendar_id` is False, leading to the traceback.

Fix:
Skip timesheet generation and upper bound check when the employee has no working
calendar (fully flexible case). A placeholder "Flexible" was also added to
the `hr.employee` form view on the field "Working Hours" when empty.

task-5048761

closes #224769

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
@robodoo robodoo added the 19.1 label Oct 30, 2025
@robodoo robodoo closed this Oct 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants