Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
3 Ответы
10428 Представления

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
Аватар
Отменить
Related Posts Ответы Просмотры Активность
4
февр. 23
42910
0
июл. 17
3174
4
сент. 21
10713
2
авг. 20
8038
1
июн. 24
1535