'Send a notification to a user for receiving a badge
Does not verify constrains on badge granting.
The users are added to the owner_ids (create badge_user if needed)
The stats counters are incremented
:param ids: list(int) of badge users that will receive the badge'

def _send_badge(self):

    Template = self.env['mail.template']
    template_id = self.env.ref('gamification.email_template_badge_received')
    for badge_user in self:
        template = template_id.get_email_template(badge_user.id)
        body_html = Template.with_context(template._context).render_template(template.body_html, 'gamification.badge.user', badge_user.id)
        badge_user.user_id.message_post(body=body_html, subtype='gamification.mt_badge_granted', partner_ids=badge_user.user_id.partner_id.ids)
    return True
