Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
2965 มุมมอง

I just started in Odoo and I am doing an exercise in which I have to make the website ask the user to log in before being able to see any of the pages.


I know it can be done page by page by changing auth="public" to "user" in the controllers but that only changes the specific pages that I modify and I need it to do it in all of them, even the ones that are added with new modules later.


I have no idea where to start.


Thanks in advance.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

I have the same question, but found how to do this for each individual website add-on, but that would take a while.  I also want to know how to do this globally to all my websites.  Here is the link to how to do it individually.

Apparently I don't have enough Karma to post a link, so here's the text from the post:

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

From the Odoo folder on your server, go to addons/website/controlers/main.py

@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.

Hope this helps!  Thanks for anyone who might know how to do this globally!

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
พ.ค. 25
2025
0
ก.ค. 24
256
1
ส.ค. 23
3191
0
พ.ค. 23
2147
0
เม.ย. 23
2816