Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
6805 มุมมอง

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?

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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

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

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ส.ค. 23
2425
0
ส.ค. 23
2019
1
ส.ค. 23
1105
2
มี.ค. 15
7613
2
ก.ค. 24
718