콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
4292 화면

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

아바타
취소