[英]Odoo, prevent redirecting after web login
从localhost:8069/web/login
到 odoo 后,我被重定向到 Odoo 后端,从那里我需要单击Website
返回主页。
我怎样才能防止这种情况? 登录后我需要留在主页内。
编辑: @moskiSRB 的回答解决了简单登录的问题。 但是注册后有自动登录仍然导致后端
如果您想为所有网站用户设置此项,您需要将他们设置为门户用户。 此外,您可以在Users->Preferences->Home Action
设置为Website 。
更新
对于注册新用户,您需要创建模板用户帐户并检查该用户的门户选项。 接下来,转到Settings->General Settings
Portal Access
Settings->General Settings
下的Settings->General Settings
, Template user for new users created through signup
找到Template user for new users created through signup
选择您的模板用户。
您可以创建一个从 res.user 继承的模型并使用计算修改 action_id。
class InheritResUsers(models.Model):
_name = 'res.users'
_inherit = ['res.users']
# Nouveaux champs
action_id = fields.Many2one('ir.actions.actions', string='Home Action', compute='get_home_page')
def get_home_page(self):
for project in self:
# we position ourselves in the ir.actions.act_window model
tasks = self.env['ir.actions.act_window']
#we search for the specific view by using the name and une xml_id
task_ids = tasks.search(
[['xml_id', '=', ' project.open_view_project_all'], ['name', '=', 'Projects']])
for task in task_ids: # Browse the table by adding the page id to the inherited action_id field
self.action_id=task.id
InheritResUsers()
在这里,我重定向到我的模块的主页。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.