Skip to Content
Menu
This question has been flagged
3 Replies
6383 Views

Hello,

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.


thanks

Avatar
Discard
Best Answer

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".

Avatar
Discard
Best Answer

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"?>
<openerp>
    <data>
        <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[
THIS IS AN AUTOMATED EMAIL. DO NOT REPLY.

Hello,

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!]]>
            </field>            
        </record>
    </data>
</openerp>

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>
        </record>

 

Avatar
Discard
Best Answer

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

Avatar
Discard