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

I would like to send an email automatically when status of sales order is changed as done. 

I would like to ask the clients to live a note about the shop. Where can i do it?


Avatar
Discard

If answer is helpful, please give up vote and Click on right tick mark.

Best Answer

Hi  S Z Ymon,

You have to customize the code for that:

You have to create cron / Action for that, it will automatically send email with your particular template.

PY file in your method:

"

Def auto_mail_send (self):

Tmpl_obj = self.pool.get ('email.template')

Tmpl_ids = tmpl_obj.search (cr, uid, [('name', '=', 'My E-mail Template'

If tmpl_ids:

     Tmpl_obj.write (cr, uid, tmpl_ids [0], {'email_to': email_to}, context = context)

     Self.pool.get ('email.template'). Send_mail (cr, uid, tmpl_ids [0], obj.id)

Return {}

"

This method should be called from the xml:

<Record id = "action_send_mail_on_partner_creation" model = "ir.actions.server">

   <Field name = "name"> Automatic Email Send action </ field>

   <Field name = "model_id" ref = "base.model_sale_order" />

   <Field name = "type"> ir.actions.server </ field>

   <Field name = "state"> code </ field>

   <Field name = "code"> self.auto_mail_send () </ field>

</ Record>


And you will have this kind of email template:


<Record id = "email_template_for_notification" model = "email.template">

<Field name = "name"> My E-mail Template </ field>

<Field name = "email_from"> $ {object.user_id.email or object.company_id.email or 'noreply @ localhost' | Safe} </ field>

<Field name = "subject"> Sale Order State Changed </ field>

<Field name = "model_id" ref = "base.model_sale_order" />

<Field name = "auto_delete" eval = "True" />

<Field name = "body_html"> <! [CDATA [

<Div> <p> <strong> Hello, </ strong> </ p>

<P> Sale order state changed $ {object.state} </ p>

<p> T Hanks  < / p>

<br/>

</ Div>

</ Field>

</ record >

H Ope this will help you.

Thank You.

Chandni


Avatar
Discard

who ever put this code here must be dumb in syntax

Best Answer

Hi, is that code is avaible in 2019 ? 
I want to make the same in odoo10 on sale order module

regards


Avatar
Discard
Related Posts Replies Views Activity
0
Nov 24
48
3
Jul 24
301
0
May 16
7238
2
Aug 24
301
1
Aug 22
1300