Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to Disconnect the users having a too old last_poll in openerp

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 294
    Comment on it

    In openerp to disconnect user and show the massage that user is disconnected and users having to old last_pool and search the limit date and write the status presences when presences is offline.
    use this function .py file show in given below,

    @api.model
        def check_users_disconnection(self):
            limit_date = (datetime.datetime.utcnow() - datetime.timedelta(0, DISCONNECTION_TIMER)).strftime(DEFAULT_SERVER_DATETIME_FORMAT)
            presences = self.search([('last_poll', '<', limit_date), ('status', '!=', 'offline')])
            presences.write({'status': 'offline'})
            notifications = []
            for presence in presences:
                notifications.append([(self._cr.dbname, 'bus.presence'), {'id': presence.user_id.id, 'im_status': presence.status}])
            self.env['bus.bus'].sendmany(notifications)
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: