I'm creating a page using the website module that would require login before a user can view. how do i create such page on Odoo 10? Thanks
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Księgowość
- Zapasy
- PoS
- Project
- MRP
To pytanie dostało ostrzeżenie
Hi,
If you are creating the page via code then you can do it like this,
Suppose you have created a new menu in the website like this,
<record id="test_menu" model="website.menu">
<field name="name">Test</field>
<field name="url">/page/test</field>
<field name="parent_id" ref="website.main_menu"/>
<field name="sequence" type="int">80</field>
<field name="website_id" ref="website.default_website"/>
</record>
Then on clicking the menu the system will search for the route /page/test
Then in the controller,
@http.route('/page/test', type='http', auth="user", website=True)
def test_test(self, **post):
return request.render('module_name.template_id')
Here if the auth="public",
then when the public user come and click on the newly created menu, he can view the page.
If the auth="user", when the public user come and clicking on the menu, he will be redirected to login page and ask to login, if he entered the login credentials properly he will directed to the page.
Then the template has to be defined,
<template id="template_id" name="Test Menu" page="True">
<t t-call="website.layout">
<div class="container">
<form>
</form>
</div>
</t>
</template>
Thanks
Podoba Ci się ta dyskusja? Dołącz do niej!
Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!
Zarejestruj sięPowiązane posty | Odpowiedzi | Widoki | Czynność | |
---|---|---|---|---|
|
2
sie 25
|
602 | ||
|
5
sie 25
|
10083 | ||
Carrusel en sitios web
Rozwiązane
|
|
2
lip 25
|
1092 | |
How to launch my website
Rozwiązane
|
|
4
cze 25
|
1263 | |
|
1
cze 25
|
1583 |