'Generate template-based values of wizard, for the document records given
by res_ids. This method is meant to be inherited by email_template that
will produce a more complete dictionary, using Jinja2 templates.
Each template is generated for all res_ids, allowing to parse the template
once, and render it multiple times. This is useful for mass mailing where
template rendering represent a significant part of the process.
Default recipients are also computed, based on mail_thread method
message_get_default_recipients. This allows to ensure a mass mailing has
always some recipients specified.
:param browse wizard: current mail.compose.message browse record
:param list res_ids: list of record ids
:return dict results: for each res_id, the generated template values for
subject, body, email_from and reply_to'

@api.multi
def render_message(self, res_ids):

    self.ensure_one()
    multi_mode = True
    if isinstance(res_ids, (int, long)):
        multi_mode = False
        res_ids = [res_ids]
    subjects = self.render_template(self.subject, self.model, res_ids)
    bodies = self.render_template(self.body, self.model, res_ids, post_process=True)
    emails_from = self.render_template(self.email_from, self.model, res_ids)
    replies_to = self.render_template(self.reply_to, self.model, res_ids)
    default_recipients = {}
    if (not self.partner_ids):
        default_recipients = self.env['mail.thread'].message_get_default_recipients(res_model=self.model, res_ids=res_ids)
    results = dict.fromkeys(res_ids, False)
    for res_id in res_ids:
        results[res_id] = {'subject': subjects[res_id], 'body': bodies[res_id], 'email_from': emails_from[res_id], 'reply_to': replies_to[res_id]}
        results[res_id].update(default_recipients.get(res_id, dict()))
    if self.template_id:
        template_values = self.generate_email_for_composer(self.template_id.id, res_ids, fields=['email_to', 'partner_to', 'email_cc', 'attachment_ids', 'mail_server_id'])
    else:
        template_values = {}
    for res_id in res_ids:
        if template_values.get(res_id):
            results[res_id].pop('partner_ids')
            results[res_id].pop('email_to')
            results[res_id].pop('email_cc')
            template_values[res_id].pop('attachment_ids', None)
        else:
            template_values[res_id] = dict()
        template_values[res_id].update(results[res_id])
    return ((multi_mode and template_values) or template_values[res_ids[0]])
