Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Automation with Email

Diogenes Ojeda
on 6/11/14, 8:27 AM 1,922 views


No way to automate sending email, for example based on the reorder point?

Example: the reorder point of a product is completed and send me an email.



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="state">email</field>
            <field name="type">ir.actions.server</field>
            <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 -->
            <field name="message"><![CDATA[


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.

Thank you!]]>

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="name">request_closed_nconf</field>
            <field name="action_id" ref="ir_actions_server_send_email_when_closed_nconf"/>
            <field name="kind">function</field>
            <field name="action">close_nconf_request()</field>
            <field name="flow_stop">True</field>



Kevin McMenamin

--Kevin McMenamin--
| 5 2 6
Auckland, New Zealand
--Kevin McMenamin--
Kevin McMenamin
On 6/12/14, 4:58 AM

if you are using V7 you could try with automated actions (under the settings menu)

On 6/12/14, 5:09 AM

Settings >> Workflows >> Workflows

Select the action the appropriate workflow, and then the activity which need to perform the action (send email).

You will find the field "server action", so create a new server action.

Action type must be "email".

Your Answer

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

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


Asked: 6/11/14, 8:27 AM
Seen: 1922 times
Last updated: 3/16/15, 8:10 AM