Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
4165 Vizualizări

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

Imagine profil
Abandonează
Cel mai bun răspuns

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

Imagine profil
Abandonează
Autor

Perfect! Thank you very much :)

Autor

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?

wait i will ans...

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

Related Posts Răspunsuri Vizualizări Activitate
1
mar. 15
3812
0
iun. 16
3696
0
sept. 15
3565
0
iul. 15
4092
2
mai 15
3493