Odoo Help


Manually send email template to multiple users from button in odoo10

Pawan Sharma
on 4/20/18, 5:41 AM 428 views

Hello All,

I try to send manual email template to multiple users by button. For this i also checked sale order 'Send By Email' code. But i getting following error.

" return self.env[model].message_get_reply_to([res_id], default=email_from)[res_id]
AttributeError: 'rental.man' object has no attribute 'message_get_reply_to' "

My Python code is here:


def email_rental_expiry(self):

ir_model_data = self.env['ir.model.data']


template_id = ir_model_data.get_object_reference('sale', 'email_template_edi_sale')[1]

except ValueError:

template_id = False


compose_form_id = ir_model_data.get_object_reference('mail', 'email_compose_message_wizard_form')[1]

except ValueError:

compose_form_id = False

print "Compose ID", compose_form_id, template_id, self.ids[0]

ctx = dict()


'default_model': 'rental.man',

'default_res_id': self.ids[0],

'default_use_template': bool(template_id),

'default_template_id': template_id,

'default_composition_mode': 'comment',

'mark_so_as_sent': True,

'custom_layout': "sale.mail_template_data_notification_email_sale_order"


res = {

'type': 'ir.actions.act_window',

'view_type': 'form',

'view_mode': 'form',

'res_model': 'mail.compose.message',

'views': [(compose_form_id, 'form')],

'view_id': compose_form_id,

'target': 'new',

'context': ctx,


print "TEMPLATE", compose_form_id, template_id, ctx, res

return res


Avinash Nk

--Avinash Nk--

| 4 3 6
Calicut, India
--Avinash Nk--


Avinash Nk
On 4/20/18, 7:09 AM


Please add message_get_reply_to  Function in your model. and return an email address.

Like this.

def message_get_reply_to(self, res_ids, default=None):
record = self.sudo().browse(res_ids)
reply_to = record.create_uid.email
return {res_ids[0]: reply_to}

Maybe your problem will be solved.


Thanks @Avinash... It's work

SunArc Technologies, Pawan Sharma
on 4/20/18, 7:30 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 4/20/18, 5:41 AM
Seen: 428 times
Last updated: 4/20/18, 7:29 AM