[英]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.