Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
4304 Lượt xem

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!

Ảnh đại diện
Huỷ bỏ
Tác giả

it does works well! thank you!


Câu trả lời hay nhất

"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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ