跳至內容
選單
此問題已被標幟
1 回覆
5708 瀏覽次數

When I click on the send button, a wizard will be displayed.
I have a list of partners (partners--->[18, 3, 19, 17]).   I want them to be added automatically in the "Recipients" field of the wizard. And, the mail will be sent to all of them.

But, I got this error :

  email_values={'email_to': user.email})
AttributeError: 'int' object has no attribute 'email'


Any help please??

My code :

for user in partners:
            mail_template.send_mail(self.id, force_send=True,
            raise_exception=True,
            email_values={'email_to': user.email})

頭像
捨棄
最佳答案

Hi,

It seems the user variable holds the record id not a record itself, so you have to get the record-set first in-order to get the email,


user_email = self.env['res.users'].browse(user).email


Thanks

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
3
2月 25
3742
0
5月 24
46
1
4月 24
3462
4
9月 23
5004
2
9月 23
7168