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

Hi,

I'm trying to remove request._env in Odoo 12 but it gives Error:

'HttpRequest' object has no attribute '_env'

my Code :

class IrHttp(models.AbstractModel):
_inherit = "ir.http"

@classmethod
def _dispatch(cls):
if not hasattr(request, "jsonrequest"):
wsr = request.env['website.seo.redirect']
del request._env
try:
return wsr.redirect_auto()
except NoRedirectError:
try:
return cls.reroute(wsr.find_origin())
except NoOriginError:
pass

return super(IrHttp, cls)._dispatch()

any ideas of why this happens?

아바타
취소
베스트 답변
What's the need to del env? anyway you can access env by request.env or request.httprequest.environ
아바타
취소
베스트 답변

Add this importation please, to use request.env

from odoo.http import request
아바타
취소
관련 게시물 답글 화면 활동
4
2월 23
43265
0
7월 17
3287
4
9월 21
10899
2
8월 20
8158
1
6월 24
1676