Odoo Help

Welcome!

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.

0

I need some info on how to insert a server action with XML for sending an email

By
Aitor Bouzas
on 1/13/15, 3:35 AM 545 views

I need some info on how to insert a server action with XML for sending an email. I've searched for it into the web, but nothing seems to help me... I just need to add a server action that sends an email and link it to a workflow (I already know how to link it to a workflow action).

Can someone help me?

Thanks in advice

2
Anand
On 1/13/15, 4:43 AM

1st create a server action...

<?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> <field name="email">object.requestor.email</field> <field name="subject">Your request object.name has been closed (not confirmed)</field> <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>

then link it in workflow activity...

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

for more check here

Perfect! Thank you very much :)

Aitor Bouzas
on 1/13/15, 5:06 AM

Do you know how to use a template too? I'd like to define a template via xml and then use it in this server action... Is there any way?

Aitor Bouzas
on 1/13/15, 5:07 AM

wait i will ans...

Anand
on 1/13/15, 5:09 AM

check it.... https://www.odoo.com/forum/help-1/question/send-email-template-through-code-21588

Anand
on 1/13/15, 5:11 AM

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)

Stats

Asked: 1/13/15, 3:35 AM
Seen: 545 times
Last updated: 3/16/15, 8:10 AM