Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
5585 Lượt xem

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})

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 2 25
3316
0
thg 5 24
46
1
thg 4 24
3237
4
thg 9 23
4712
2
thg 9 23
6930