Skip to Content
Menu
This question has been flagged
2 Replies
20483 Views

How to set session and get session value in odoo 10

i have a login page , when user provides email and password and when he logged in    i want to capture email address trough session


thanks in advance

Avatar
Discard
Best Answer

Hi,

If you want to set a value in the session , you can do it as follows,

request.session['val_name'] = value

To access the value which set in the session,

request.session['val_name']

Thanks

Avatar
Discard
Best Answer

Hello, this is a nice concept. But I was trying to do the same thing and updating the uid,login and session_token in request.session. But I am getting logged out. Can you help me with this.

Session Data before Data Modified:

<OpenERPSession {'db': 'SAS_odootest11newscript', 'uid': None, 'login': None, 'session_token': None, 'context': {'lang': 'en_US', 'uid': 16}, 'geoip': {}, '__payment_tx_ids__': [103], '__website_sale_last_tx_id': 103, 'sale_order_id': None, 'sale_last_order_id': 108, 'sale_transaction_id': False, 'website_sale_current_pl': False}>

Session Data after Data Modified:

<OpenERPSession {'db': 'SAS_odootest11newscript', 'uid': 16, 'login': 'test2', 'session_token': 'fd55f28ebf1b7002803dcf1cc3ac5244aef10fc0a0fac1e0d10266ad440573dc', 'context': {'lang': 'en_US', 'uid': 16}, 'geoip': {}, '__payment_tx_ids__': [103], '__website_sale_last_tx_id': 103, 'sale_order_id': None, 'sale_last_order_id': 108, 'sale_transaction_id': False, 'website_sale_current_pl': False}*>


Avatar
Discard