跳至內容
選單
此問題已被標幟
2 回覆
4239 瀏覽次數

I want to save some infomation to session  in model method,but i can not get  session object,how to get it  ,my  odoo version is 16,thanks!

頭像
捨棄
作者

it does works well! thank you!


最佳答案

"ir.http" is the object you need to use for session information.

session_info = self.env['ir.http'].session_info()
session_info.update(
custom_values='xyz'
)

--

Meet Dholakia

www.entrivistech.com

頭像
捨棄
最佳答案

Hi,

You can get the session object by first importing the request object from odoo like

from odoo.http import request

then you can get the session from request, that can be done by 

request.session

Regards

頭像
捨棄