Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
9100 Представления

I'm triying to pass context to the email template but keep an error:

TypeError: send_mail() got an unexpected keyword argument 'context'

And the code:

def payment_email(self):
        template_id = self.env.ref('seguro.email_template_payment_info').id
        context = {
        'unpaid_employees':self.search_salaries_unpaid()
        }
            
        self.env['mail.template'].browse(template_id).send_mail(self.id, force_send=True, context=context)

Without the context parameter all works fine. I'm using version 13.0

Is there a way to pass the context? All that I found it is for older versions.

Аватар
Отменить
Лучший ответ

Hello try :

self.env['mail.template'].browse(template_id).with_context(context).send_mail(args)

Аватар
Отменить
Related Posts Ответы Просмотры Активность
3
дек. 24
5542
1
мар. 21
7088
0
окт. 15
3895
0
июл. 24
1266
2
апр. 23
3033