mail create using python – odoo

    def create(self, vals):
        values = {}
        mail_mail = self.env['mail.mail']
        # context: no_log, because subtype already handle this
        result = super(HelpdeskTicket, self.with_context(mail_create_nolog=True)).create(vals)

        values['subject'] = 'ePillars Support Case Created - %s  [%s]' % (,
        values['body_html'] = """<html>
                                Case Number:	"""+str( +"""<br/>
                                Support Account Name:	"""+ str("""<br/>
                                Support Account Email:	"""+ str(result.partner_email)+"""<br/>
                                Status:	New <br/>
                                Subject:	"""+str( +"""<br/><br/><br/>

                                You will not be able to 'Reply' to this e-mail. If you wish to contact us,<br/> 
                                Please call +97143263939.
        values['email_from'] = 'ePillars Support<>'
        values['email_to'] = result.partner_email
        values['reply_to'] = 'noreply<>'
        if values['email_to']:
            mail= mail_mail.create(values)
        return result

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s