'Helper method to send a mail with a template
:param template_id : the id of the template to render to create the body of the message
:param **kwargs : parameter to create a mail.compose.message woaerd (which inherit from mail.message)'

@api.multi
def message_post_with_template(self, template_id, **kwargs):

    if (not kwargs.get('composition_mode')):
        kwargs['composition_mode'] = ('comment' if (len(self.ids) == 1) else 'mass_mail')
    if (not kwargs.get('message_type')):
        kwargs['message_type'] = 'notification'
    res_id = (self.ids[0] or 0)
    composer = self.env['mail.compose.message'].with_context(active_ids=self.ids, active_model=self._name, default_composition_mode=kwargs['composition_mode'], default_model=self._name, default_res_id=(self.ids[0] or 0), default_template_id=template_id).create(kwargs)
    if template_id:
        update_values = composer.onchange_template_id(template_id, kwargs['composition_mode'], self._name, res_id)['value']
        composer.write(update_values)
    return composer.send_mail()
