Help

2

How to redirect to the shop website after the customer log in into my system odoo 8?

Scenario:

I'm working on a local odoo 8.

I have a website shop that it is not available for public. By the business policies the customer have to sign a contract and then the administrator provide user and password for the customer to be able to shop in our website. 

Using a security rule I'm hiding the shop tab for a public users and it is available back just for registered users. 

Problem:

When a customer log in successfully the system automatically redirect them to the portal. I would like to know if there is a way to modify this in order to redirect our customers to the shop automatically after the log in. 

 

Thank you. 

2 Comments
Avatar
Discard
Avatar
grayson
-

I am also looking for a solution to this. I tried setting the default new user template to have a default "Home Action" as Website Shop and this redirects them to the shop on login. But then when they clock the "My Account" button they are redirected back to shop, effectively disabling the portal outside of links from within system emails. This is not desired as the customer should be able to select "My account" should they want to see the status of their orders.

From where the customer arrives on your login page ? If the link can be customized, you can redirect user to /web?redirect=/shop Once logged, user will be redirected to /shop

4 Answers
5
Best Answer

You can also update the view "web.login" ...

replace

<input type="hidden" name="redirect" t-att-value="redirect"/>

by

<input type="hidden" name="redirect" t-att-value="redirect + '&amp;redirect=/shop' "/>

EDIT 

by:

<input type="hidden" name="redirect" t-att-value="'%s%s' % (redirect or '', (redirect and '&amp;' or '?' ) + 'redirect=/shop' )"/>

Keeping the first redirect is not useless ! ...

/web/login and /web allow redirect as param.

So if a real redirect: (session expired eg)

     /web?#model=res.partner&active_id=1&redirect=/shop --> no redirect (#)

else:

    /web?redirect=/shop --> redirected to /shop

4 Comments
Avatar
Discard
Avatar
grayson
-

This is working partially. When there is a redirect ie logging in from https://www.example.com/web/login?redirect=https%3A%2F%2Fwww.example.com%2Fweb I get taken to a 404 page at https://www.example.com/web&redirect=/shop Works great when there is no redirect though.

Yes, you can update the input with something like that.. it should works... let us know !

Avatar
Edser Solis
-

Hello this worked for me pretty good. But is there anyway it redirects customers to a page and users (employees) to a different page or directly to system back-end (dashboard)? I have user groups configured and have pages that show or not depending on the group the customer belongs to.

Avatar
Jérémy Kersten (jke)
-

2 easy way to do it: or you make the redirect from server side when you know if user is a customer or an employee (python code). Or if you don't want create python code server side (eg: on saas), you redirect always on a dispatcher page... which one will redirect to the right page. (2 simple if in qweb)... if user has group base.group_user -> redirect /xxx , if not has group -> redirect /yyy but it will add a redirect and so a request...

2
Best Answer



Hi José Andrés,

In the users you want to change this, you have to complete the field "Menu personalization", completing with the menu you want to redirect, as this images show:


Regards.

2 Comments
Avatar
Discard
Avatar
Ing. Daniel Blanco
-

Juan José, the problem with this setting, is that if user is a portal user, and want to go to the portal menu, using "my account" option, it bounces again to the website. (previously, it shows portal menu for a while and make a bounce)

Avatar
DWARKANATH BARI
-

Hello I have a query, I create a demo user on ecommerce with dont have an account, after user creating and login with demo that user directly view ecommerce website like showing products of page. Now when that user is logged in showing Home Shop Contact Use <Demo User> when click on Shop showing product page. Can u help me for this. In screenshot 1 i Logged in as a test user then i need to click on shop for viewing products in screenshot 2nd.

2
Best Answer

@Glen-Erik

You should be able to do exactly the same thing in your template

auth_signup.reset_password

Just replacing 


    <input type="hidden" name="redirect" t-att-value="redirect" />


by


    <input type="hidden" name="redirect" t-att-value="redirect or '/shop'" /> 

 

Avatar
Discard
0
Best Answer

This works great for web.login but doesn't work for auth_signup.reset_password. What is the syntax or method to change the redirect when someone confirms their account via creating a password?

When you invite someone and they confirm their account, they are sent to the auth_signup.reset_password page to create a password. Then they are redirected to the portal instead of any website page.

Avatar
Discard