简体   繁体   中英

Odoo, prevent redirecting after web login

After I login to odoo from localhost:8069/web/login I get redirected to Odoo backend, from where I need to click Website to come back to Home Page .

How can I prevent this? I need to stay inside the home page after login.

EDIT: @moskiSRB 's answer solves the problem for simple login. But after Signup there is auto login which still leads to backend

If you wanna set this for all website users you need to set them to portal users. Also, you can set under Users->Preferences->Home Action set to Website .

UPDATE

For signup new users you need to create template user account and check portal options for that user. Next, go to Settings->General Settings under Portal Access find Template user for new users created through signup choose your template user.

you can create a model that inherits from res.user and modify the action_id with a compute.

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()

Here I redirect to the home page of my module.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM