If you are doing via custom module you can do it via XML files. Here is a working example I have in my module. You just have to create a server action and call it from your workflow:
Server action creation (you can access the data stored in your database and include it in your email message using the notation [[object.xxx]], where xxx is the name of the field you want to include):
<?xml version="1.0" encoding="UTF-8"?>
<record id="ir_actions_server_send_email_when_closed_nconf" model="ir.actions.server">
<field name="name">Auto-email when request is closed, not confirmed</field>
<field name="model_id" ref="model_generic_request"/>
<field name="condition">True</field> <!-- might or might not include an extra condition -->
<field name="email">object.requestor.email</field> <!-- get the user email from database -->
<field name="subject">Your request object.name has been closed (not confirmed)</field> <!-- object.name fetches the field from database -->
THIS IS AN AUTOMATED EMAIL. DO NOT REPLY.
We are here to inform you that the request [[object.name]] you submitted on [[object.request_date]] with the following data:
| Request - Details
| Number: [[object.id]]
| Responsible Person: [[object.responsible_name.name]]
| Request description: [[object.request_description]]
| Stating reasons: [[object.stating_reasons]]
| Notes: [[object.notes]]
Has not been confirmed and is closed.
If you have any question, do not hesitate to contact your supervisor.
In the definition of your workflow activities call the action server:
<record model="workflow.activity" id="act_closed_nconf">
<field name="wkf_id" ref="wkf_request" />
<field name="action_id" ref="ir_actions_server_send_email_when_closed_nconf"/>
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 6/11/14, 8:27 AM|
|Seen: 1922 times|
|Last updated: 3/16/15, 8:10 AM|