Skip to Content
Menu
This question has been flagged
1 Reply
3660 Views

Hi, I would like to know how to configure an automated email notification on each workflow and action done by a user, for example in "Purchase Order" I have 3 levels of approval:

UserA: Created a Purchase Order (upon clicking "Save" button it should automatically trigger to send an email to the next level approver)


Approver1: Can either "Approve", "Reject", or "Send back for revision".

                    -Should the request is rejected or send for revision by the "Approver1" system should trigger an automated email to "UserA" stating the status of the request. 

                    -Upon clicking the "Approve" button it should send an automated email to "Approver2".


Approver2: Can either "Approve", "Reject", or "Send back for revision".

                   -Should the request is rejected or send for revision by the "Approver2" system should trigger an automated email to "UserA" stating the status of the request. 

                    -Upon clicking the "Approve" button it should send an automated email to "Final Approver".


Final Approver: Can either "Approve", "Reject", or "Send back for revision".

                    -Should the request is rejected or send for revision by the "Final Approver" system should trigger an automated email to "UserA" stating the status of the request. 

                   -Upon clicking the "Approve" button it should send an automated email to "UserA" stating the request has been approved.


Note: "Approver1" being the department manager, in case of multiple departments in the company the system should identify the approver based on the user's department.

Any suggestion is highly appreciated. Thank you for the support.

Avatar
Discard
Best Answer

Hi,

Here  you have to  code for sending mail to proper user in the button action. If you already have button , then in the action of the button just add the code to send the mail,

template_obj = self.env['mail.mail']
template_data = {
'subject': 'Test : ',
'body_html': 'ABcde,
'email_from': self.env.user.company_id.email,
'email_to': 'niyasraphyk@gmail.com
}
template_id = template_obj.create(template_data)
template_obj.send(template_id)

Thanks

Avatar
Discard