Skip to Content
Menu
This question has been flagged
3820 Views
@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 ?

Avatar
Discard
Related Posts Replies Views Activity
3
Jul 19
14016
0
May 19
3555
2
Jan 20
6537
3
Aug 19
10633
1
Jan 19
4687