コンテンツへスキップ
メニュー
この質問にフラグが付けられました
3 返信
10432 ビュー

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
42914
0
7月 17
3184
4
9月 21
10720
2
8月 20
8046
1
6月 24
1537