Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
3 Replies
10654 Tampilan

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?

Avatar
Buang
Jawaban Terbai
What's the need to del env? anyway you can access env by request.env or request.httprequest.environ
Avatar
Buang
Jawaban Terbai

Add this importation please, to use request.env

from odoo.http import request
Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
4
Feb 23
43429
0
Jul 17
3320
4
Sep 21
10988
2
Agu 20
8212
1
Jun 24
1716