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

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

อวตาร
ละทิ้ง