This question has been flagged
7 Replies
16894 Views

Hi,

I need to send an email to the manager of the employee whenever an employees applies a leave and also need to send an email to the user when manager approves or reject the leave application.

Avatar
Discard
Best Answer

For this you want to create two server action. Setting->Technical->Actions->Server Actions. Create a new server action for leave request to manager Action name:leave_request_manager.

Object:Leave

Action type:Email

Condition:True

Email Address: object.employee_id.parent_id.work_email

Subject: Leave Request from [[ object.employee_id.name ]]

Message: Dear [[object.employee_id.parent_id.name]],

You have one Leave Request from [[ object.employee_id.name ]]. Kindly click the link below to validate the application form. Web: localhost:8069 or ipaddress:8069

Thank you.

Create a new server action for approve mail from manager.

Action name:leave_approval_manager.

Object:Leave

Action type:Email

Condition:True

Email Address: object.employee_id.work_email

Subject: Leave Approval of [[object.employee_id.name]]

Message: Dear [[object.employee_id.name]]

[[object.number_of_days_temp]] day(s) leave from '[[object.date_from]]' to '[[object.date_to]]' has been approved.

Thank You.

Action name:leave_refusal_manager.

Object:Leave

Action type:Email

Condition:True

Email Address: object.employee_id.work_email

Subject: Leave Refusal of [[object.employee_id.name]]

Message: Dear [[object.employee_id.name]]

[[object.number_of_days_temp]] day(s) leave from '[[object.date_from]]' to '[[object.date_to]]' has been refused.

Thank You.

Next step is you want to call these server actions from workflow.

Setting->Technical->Workflow->Workflow->hr.wkf.holidays

confirm->server action->leave_request_manager

validate->server action->leave_approval_manager

refuse->server action->leave_refusal_manager(Kind:Dummy in Workflow)

Thus you can configure it

Avatar
Discard

Thanks, it works and was very usefull to me

This is really useful! Especially on how to embed the fields from the data!

This really helped me a lot, but I have a question - posted here --> http://help.openerp.com/question/42224/how-to-set-more-than-one-email-in-server-action/

Best Answer

I ma unable to send mail... :( Can u help me plzzzz.....

i am getting error as

Mail delivery failed

Mail delivery failed via SMTP server 'smtpout.asia.secureserver.net'. SMTPSenderRefused: 550 <name@name> size=540 invalid address name@name

Avatar
Discard

please specify your overall configuration

Best Answer

Even I have the same problem of sending email notifications of leave management. Kindly, please do assist me with the same in Odoo 10 because what's above is completely different from the ones that Odoo 10 is having right now. Thanks in Advance!

Avatar
Discard