Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
4842 Lượt xem
@api.multi
def send_email(self, object, user_ids):
mail_obj = object
body_html = ''
current_url = ''
you = ''
base_url = str(self.env['ir.config_parameter'].get_param('web.base.url')) + '/web?db=' + str(http.request.session.db) + '#id=' + str(object.id) + '&view_type=form&model=modul.control.alerts&action=' + str(self.env['ir.model.data'].get_object_reference('mail', 'email_compose_message_wizard_form')[1])
for line in user_ids:

user = self.env['res.users'].search([('id','=', line)])
if user.email:
you = you + ',' + user.email
else :
raise UserError(_('Please check user email, there is no user email.'))
if you:
outgoing_email = self.env['ir.mail_server'].search([])
if not outgoing_email:
raise exceptions.ValidationError(_('There is no configuration for outgoing mail server. Please contact system administrator.'))
else:
outgoing_email = self.env['ir.mail_server'].search([('id', '=', outgoing_email[0].id)])
email_ids = []
vals = {
'state': 'outgoing',
'subject': '',
'body_html': +'<a href="' + base_url + '">link:</a>',
'email_to': user.email,
'email_from': outgoing_email.smtp_user,
}
email_ids.append(self.env['mail.mail'].create(vals))


bold code is not working, how to fix any idea ?

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 7 19
15280
0
thg 5 19
5073
2
thg 1 20
7575
3
thg 8 19
12195
1
thg 1 19
5698