Hi,
You can override the method that validates the first approval (action_approve) in the hr_holidays model and add logic to:
Reassign the request to the HR manager,
Send an email notification automatically.
Code:
from odoo import api, models
class HrLeave(models.Model):
_inherit = 'hr.leave'
@api.multi
def action_approve(self):
res = super(HrLeave, self).action_approve()
for leave in self:
# Check if double validation is needed
if leave.holiday_status_id.validation_type == 'both':
# Automatically reassign to HR Manager group
hr_group = self.env.ref('hr_holidays.group_hr_holidays_manager')
hr_manager_users = hr_group.users
if hr_manager_users:
leave.write({'manager_id': hr_manager_users[0].id})
# Send email notification
template = self.env.ref('hr_holidays.mail_template_leave_approval_manager', raise_if_not_found=False)
if template:
self.env['mail.template'].browse(template.id).send_mail(leave.id, force_send=True)
return res
Hope it helps