Skip to content
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

[15.0][FIX] hr_holidays_public: fixed action_validate() override #114

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions hr_holidays_public/models/hr_leave.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,16 @@ def action_validate(self):
actions derived from this validation. This is required for example for
`project_timesheet_holidays` for not generating the timesheet on the public holiday.
Unfortunately, no regression test can be added, being in a separate module."""
if self.holiday_status_id.exclude_public_holidays or not self.holiday_status_id:
self = self.with_context(
employee_id=self.employee_id.id, exclude_public_holidays=True
)
return super(HrLeave, self).action_validate()
for leave in self:
if (
leave.holiday_status_id.exclude_public_holidays
or not leave.holiday_status_id
):
leave = leave.with_context(
employee_id=leave.employee_id.id, exclude_public_holidays=True
)
super(HrLeave, leave).action_validate()
return True

def _get_number_of_days(self, date_from, date_to, employee_id):
if self.holiday_status_id.exclude_public_holidays or not self.holiday_status_id:
Expand Down
Loading