Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
1031 Tampilan

Hello,  is there a way to set it so a manager is notified when someone cancels PTO that has been approved already?

Avatar
Buang
Jawaban Terbai

Hello James Hinton,

I hope you are doing well.

Here, you can find an example of automated action to notify the person responsible / manager for the employee cancels Paid Time Off Leave.

Find Example in the comment.

I hope this can help you.

Thanks & Regards,
Email:   odoo@aktivsoftware.com 

Skype: kalpeshmaheshwari

Avatar
Buang

For Example -
Note - Check Indentation of the code after pasting the code.
Change the f String as per your requirement.

- Create an automated action by adding
name, model( Time Off (hr.leave) as per your requirement),
trigger(update as per your requirement), Trigger fields (Active (hr.leave), Before Update Domain( Active is set ), Apply on ( Active is not set ) as per your requirement), Action To Do ( Execute Python Code ).

- In the Python Code Below Paste this code:-

for leave in records:
if leave.holiday_status_id.name == 'Paid Time Off' and leave.employee_id.parent_id:
leave.employee_id.parent_id.message_post(message_type="notification", body=f"Notification: {leave.employee_id.name} has canceled the PTO Leave")