我在odoo15中运行了一个项目并创建了数据库,但是在尝试打开登录页面之后,我出现了这个错误。有人能帮我吗。
Error when render the template
AttributeError: 'ir.http' object has no attribute 'get_frontend_session_info'
Template: web.frontend_layout
Path: /t/html/head/script[2]/t
Node: <t t-out="json.dumps(request.env['ir.http'].get_frontend_session_info())"/>;
if (!/(^|;\s)tz=/.test(document.cookie)) {
const userTZ = Intl.DateTimeFormat().resolvedOptions().timeZone;
document.cookie = `tz=${userTZ}; path=/`;
} - - -
发布于 2022-05-11 10:59:36
对我来说,解决方案是在./odoo/odoo/addons/base/model/ir_http.py文件中添加以下脚本:
@api.model
def get_frontend_session_info(self):
return {
"is_admin": self.env.user._is_admin(),
"is_system": self.env.user._is_system(),
"is_website_user": self.env.user._is_public(),
"user_id": self.env.user.id,
"is_frontend": True,
}
https://stackoverflow.com/questions/72126658
复制相似问题