Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
7231 Widoki

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?

Awatar
Odrzuć
Najlepsza odpowiedź

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

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

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
sie 23
3023
0
sie 23
2467
1
sie 23
1629
2
mar 15
7939
2
lip 24
1278