'Call by the cron.'

@api.model
def synchronize_events_cron(self):

    users = self.env['res.users'].search([('google_calendar_last_sync_date', '!=', False)])
    _logger.info('Calendar    Synchro    -    Started    by    cron')
    for user_to_sync in users.ids:
        _logger.info('Calendar    Synchro    -    Starting    synchronization    for    a    new    user    [%s]', user_to_sync)
        try:
            resp = self.sudo(user_to_sync).synchronize_events(lastSync=True)
            if (resp.get('status') == 'need_reset'):
                _logger.info('[%s]    Calendar    Synchro    -    Failed    -    NEED    RESET        !', user_to_sync)
            else:
                _logger.info('[%s]    Calendar    Synchro    -    Done    with    status    :    %s        !', user_to_sync, resp.get('status'))
        except Exception as e:
            _logger.info('[%s]    Calendar    Synchro    -    Exception    :    %s    !', user_to_sync, exception_to_unicode(e))
    _logger.info('Calendar    Synchro    -    Ended    by    cron')
