Chapter 10 - Odoo 15 Development Book

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.

odoo-development-book

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.

odoo-development-book

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.

odoo-development-book

Users can switch from websites using the dropdown menu.

odoo-development-book

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.

odoo-development-book

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
   ])
whatsapp
location

Calicut

Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635

location

Kochi

Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.

location

Bangalore

Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message