'Verify if a goal has not been updated for some time and send a
reminder message of needed.
:return: data to write on the goal object'

def _check_remind_delay(self):

    if (not (self.remind_update_delay and self.last_update)):
        return {}
    delta_max = timedelta(days=self.remind_update_delay)
    last_update = fields.Date.from_string(self.last_update)
    if ((date.today() - last_update) < delta_max):
        return {}
    template = self.env.ref('gamification.email_template_goal_reminder').get_email_template(self.id)
    body_html = self.env['mail.template'].with_context(template._context).render_template(template.body_html, 'gamification.goal', self.id)
    self.env['mail.thread'].message_post(body=body_html, partner_ids=[self.user_id.partner_id.id], subtype='mail.mt_comment')
    return {'to_update': True}
