14

How Odoo store the login session when user logged in. I have searched many link but didn't get any satisfied answer. can anyone explain session in odoo.

Atul Arvind
  • 16,054
  • 6
  • 50
  • 58

2 Answers2

12

Session in odoo v8 is stored in file system. the path of the session is in the default data directory. it can be

Mac OS X: ~/Library/Application Support/odoo
Unix: ~/.local/share/odoo  
Win XP: C:\Documents and Settings\<username>\Local Settings\Application Data\<AppAuthor>\odoo
Win 7: C:\Users\<username>\AppData\Roaming\<AppAuthor>\odoo
windows 10: C:\Users\<username>\AppData\Local\OpenERP S.A\Odoo\sessions

For Unix, Odoo follows the XDG spec and supports $XDG_DATA_HOME. That means, by default ~/.local/share/Odoo

Atul Arvind
  • 16,054
  • 6
  • 50
  • 58
  • I found the question in 2021 and I want to update the answer for those who come here later .Session in Odoo v13. `windows 10: C:\Users\\AppData\Local\OpenERP S.A\Odoo\sessions` – manhvd Jun 04 '21 at 16:22
7

In your openerp-server-conf you can define the custom file storage path using the attribute

data_dir = 'Your custom path'

If you need to access the odoo session in your codes, just try following possibilities

in python script:

 session = env['ir.sessions']

 or
 session = request.session
 or
 you can get session info from the route '/web/session/get_session_info'
 ie, 
@http.route('/web/session/get_session_info',type='json',auth="none")
def get_session_info(self):
    request.uid = request.session.uid
    request.disable_db = False
    return self.session_info()

In js

try to Implement operations on 
var session = require('web.session'); this session object

Cheers !

Hilar AK
  • 1,655
  • 13
  • 25