Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
2 Răspunsuri
7219 Vizualizări

Is there a way in which I can track when a user has logged in and logged out in Odoo 13 community edition? I tried doing this:

    def check(self, db, uid, passwd):
        res=super(UserInfo, self).check(db, uid, passwd)


        # base_url = self.env['ir.config_parameter'].get_param('web.base.url')
        # _logger.info(base_url)
        req = request.httprequest
        base_url = req.base_url
        if base_url.split('/')[-1] == 'logout':
            session_id = request.session.uid
            log_id = self.env['user.session'].search([['session_id','=',session_id]])
            sign_out = fields.datetime.now()
            vals = {'sign_out':sign_out}
            log_id.write(vals)
        return res


but it does not work. Can anyone help me out?

Imagine profil
Abandonează
Cel mai bun răspuns

Hi Utsav,
I hope this app will be help full for you,

https://apps.odoo.com/apps/modules/13.0/restrict_logins/
Thanks

Imagine profil
Abandonează
Cel mai bun răspuns

Hello Utsav, 


In Odoo Inside "OpenERPSession" class there is method "authenticate"

Whenever user log-in and logout from his/her Odoo then the message triggers. 

For method please refer to this link

https://github.com/odoo/odoo/blob/13.0/odoo/http.py#L989 


You can also look at the following module

https://store.webkul.com/Odoo-User-Login-Security.html 


Thanks

Anisha Bahukhandi

Technical Content Writer

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
1
aug. 23
3003
0
aug. 23
2466
1
aug. 23
1614
2
mar. 15
7932
2
iul. 24
1275