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

Template mail Odoo Error

By
emna
on 11/5/16, 8:17 AM 87 views

Hello,

I created a module to send a scheduled daily mail.

the mail is successfully sent.

But In mail, body does not appear correctly.

this is my code and the output

code:

def send_crm_report(self, cr, uid, ids=None, context=None):

        message_obj = self.pool.get('mail.message') mail_mail = self.pool.get('mail.mail') mail_ids = [] today = datetime.now().strftime('%Y-%m-%d 00:00:00') par_id = message_obj.search(cr, uid, [('date', '>', today), ('model', '=', 'crm.lead') ]) if par_id:

            try:

                email_from = "crm@exemple.com" name = "Name" subject = "CRM Report" mail_ids.append(mail_mail.create(cr, uid, { 'email_to': "emna.hidri@gmail.com", 'subject': subject, 'body_html': '<table><tbody><tr><th style="width:135px">Vendeur</th><th style="width: 85px;">opportunite</td><th style="width: 125px;">Description</th></tr> % for row in message_obj.browse(cr, uid, par_id): <tr><td> ${row.author_id.name} </td><td style="text-align: center;"> ${row.subject or ''} </td><td> ${row.body or ''} </td></tr> %endfor <tbody><table>'

                    }, context=context)) mail_mail.send(cr, uid, mail_ids, context=context) except Exception, e:

                print "Exception", e return None

output:

Vendeur opportunite Description

% for row in message_obj.browse(cr, uid, par_id):

${row.author_id.name} ${row.subject or } ${row.body or }%endfor



Thanks for reply

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: 11/5/16, 8:17 AM
Seen: 87 times
Last updated: 11/5/16, 9:53 AM