Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
1 Vastaa
4504 Näkymät

Hi,

is possible to add login protection to odoo eshop ?

my goal is make all products invisible and show them after you put user name and password.

Thank you.

Mike

Avatar
Hylkää
Paras vastaus

Hi Mike,

Yes this is possible! This behaviour is controlled by the Odoo controllers. So you should override the default controller for the webshop and modify the @http.route so you need to be authenticated before you can see the products. A small example:

@http.route(['/shop'], type='http', auth="user", website=True

In this example the user has to be logged in because of the auth="user" and cannot acces it without being logged in.

Yenthe

Avatar
Hylkää
Tekijä

Hi Yenthe, added this code for main page, and works, but when i swich to shop page still see products. If i add your line to controller, nothing happens. line with [/shop] doesnt exist in controller main.py

Tekijä

my fault, addons/website_sale/controlers/main.py

Good to hear you got it going! Best of luck with Odoo.

Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
0
maalisk. 15
5092
2
tammik. 25
1006
2
toukok. 25
4319
Duplicate Ratkaistu
1
jouluk. 24
16522
2
lokak. 24
1489