def
od_discount_approved(self, cr, uid, ids, context=None):
self.write(cr,uid,ids,{'od_sales_man_discount_ctrl':False},context)
self.od_send_mail(cr,uid,ids,'rso_disc_approved_mail_to_salesperson',context=context)
return True
def
od_send_mail(self,cr,uid,ids,template,context=None):
ir_model_data =
self.pool['ir.model.data']
email_obj = self.pool.get('email.template')
template_id = ir_model_data.get_object_reference(cr,uid,'orchid_rso',
template)[1]
sale_id =
self.browse(cr,uid,ids,context) and
self.browse(cr,uid,ids,context).id
email_obj.send_mail(cr,uid,template_id,sale_id,
force_send=True)
return
True
Through default data loading technic,you can create a template.
<record id="task_reviewer_mail" model="email.template">
<field name="name">Task Reviewer Mail</field>
<field name="email_from">${(user.email or '')|safe}</field>
<field name="subject">Task</field>
<field name="email_to">${object.reviewer_id.email}</field>
<field name="model_id" ref="project.model_project_task"/>
<field name="body_html"><![CDATA[
<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; ">
<p>Dear ${object.reviewer_id.name or 'Reviewer'},</p>
<p>Please Check The task</p>
<p>Thank You</p>
</div>
]]></field>
</record>
<record id="task_creation_auto_mail_customer" model="email.template">
<field name="name">Task Customer Mail</field>
<field name="email_from">${(user.email or '')|safe}</field>
<field name="subject">Task To Customer</field>
<field name="email_to">${object.partner_id.email}</field>
<field name="model_id" ref="project.model_project_task"/>
<field name="body_html"><![CDATA[
<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; ">
<p>Dear ${object.partner_id.name or 'Customer'},</p>
<p>Please Check</p>
<p>Thank You</p>
</div>
]]></field>
</record>
<record id="lead_to_opportunity_mail" model="email.template">
<field name="name">Lead To Opportunity Mail</field>
<field name="email_from">${(user.email or '')|safe}</field>
<field name="subject">Lead To Opportunity</field>
<field name="email_to">test@gmail.com</field>
<field name="model_id" ref="crm.model_crm_lead"/>
<field name="body_html"><![CDATA[
<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; ">
<p>Dear ,</p>
<p>Please Check The task</p>
<p>Thank You</p>
</div>
]]></field>
</record>
<record id="disc_approved_mail_to_salesperson" model="email.template">
<field name="name">Disc Approved Mail to Salesman</field>
<field name="email_from">${(user.email or '')|safe}</field>
<field name="subject">Discount Approved</field>
<field name="email_to">test@gmail.com</field>
<field name="model_id" ref="sale.model_sale_order"/>
<field name="body_html"><![CDATA[
<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; ">
<p>$Dear ${object.user_id.name or 'Salesman'},</p>
<p>Quotation No:${object.name or 'Quotation'}</p>
<p>Thank You</p>
</div>
]]></field>
</record
No comments:
Post a Comment