Multi Website
Odoo website module enables you to manage multiple websites in a single Odoo instance.
After installing the website module, you can go to Configuration > Settings, from where
you can create and manage multiple websites.
For creating a new website user should click on this create new website option and fill
this form out. After creating the website, you can use a different theme for that. In
fact different themes can be used for different website creations.
Once the website is created, you can design it using a website builder. The website
builder is the tool used for building and customizing website pages. Using website
builder, users can create menus as well.
Users can switch from websites using the dropdown menu.
It is possible to customize the visitor experience for each website. A customized menu is
given for this purpose. Each option given here is website specific. Also, these options
depend upon the page from which you are accessing the menu options. Users can easily
configure settings options from here.
Now let us discuss the technical aspects of multiple websites in Odoo. If you want to
show a few objects in a multi-website environment, below are some points to remember.
- 1. It is important to add the domain in the route based on the website. This helps
in publishing only available records in each website’s sitemap.
- 2. For checking the access property, you should call the method can_access_from_current_website(). This method makes
sure that the visitor sees only those records of the current website.
- 3. When records are searched, specify the website domain as well.
@http.route('''/student/<model("student.student","[('website_id', 'in', (False, current_website_id))]"''',
auth="public", type='http', website=True)
def student(self, blog=None):
if not blog.can_access_from_current_website():
raise werkzeug.exceptions.NotFound()
domain = request.website.website_domain()
students = request.env['student.student'].sudo().search([
domain
])