Odoo Help

0

Failed to render template Odoo 9 Error

By
Jorge
on 30/10/17 06:53 177 views

Hello guys, I created a email template for hr.holidays module but when I try to send the email I get the following error:

Failed to render template <Template memory:7f29b07bc750> using values {'format_tz': <function <lambda> at 0x7f29bf509938>, 'ctx': {}, 'user': res.users(6,), 'object': None}

This is my code:

                mail_ids = []

                mail_pool = self.pool['mail.mail']

                data_pool = self.pool['ir.model.data']

                local_context = context.copy()

                template_xmlid = 'holidays_email_template_a_manager_aprobar'

                template_pool = self.pool.get('mail.template')

                dummy, template_id = data_pool.get_object_reference(cr, uid, 'hr_holidays', template_xmlid)

                for attendee in self.browse(cr, uid, ids, context=context):

                    manager = attendee.department_id.manager_id.user_id.email

                    mail_id = template_pool.send_mail(cr, uid, template_id, manager, context=local_context)

                    mail_ids.append(mail_id)

                mail_pool.send(cr, uid, mail_ids, context=context)


Anyone could help me with this error? Thanks!

0
Raaj Mishra
On 30/10/17 09:17

Have you defined this template at your custom module..? If yes then you need to get the template id using your custom module reference not hr_holidays.

line : dummy, template_id = data_pool.get_object_reference(cr, uid, 'hr_holidays', template_xmlid)

So instead of hr_holidays you need to pass your custom module name.

I added this template to hr.holidays, so isn't a custom module

Jorge
on 30/10/17 09:39

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 30/10/17 06:53
Seen: 177 times
Last updated: 30/10/17 09:17