Introduction
In Odoo, models define how data is structured and stored in the database. Every piece of business data you work with lives in a model.
Understanding Odoo models is essential for both developers and functional consultants. Models are the foundation of the Odoo data architecture. They define Odoo fields, relationships, and business logic.
This article focuses on the website model. It powers site configuration in Odoo. Whether you are building multi-website setups, customizing branding, or integrating with external systems, you will work with this model.
What is the website Model
The website model represents a website configuration in Odoo. This model in Odoo stores everything that defines how a site looks and behaves: domain, languages, branding, social links, and menu structure.
It is part of the Website app and is used by every Odoo website. In multi-website setups, you have multiple website records. Each one can have its own domain, company, languages, and theme.
Other models in Odoo reference the website model via the website_id field. Many Odoo models have a website_id field to scope content to a specific site. This is how Odoo model inheritance and the api model in Odoo work together.
Key Fields in the Model
Here are the most important Odoo fields in the website model. Understanding these will help you work effectively with site configuration.
1. name
Type: Char. Required. This field stores the website name. It is displayed in the backend switcher and in configuration screens. It is the primary identifier for the site.
2. sequence
Type: Integer. Default 10. Controls display order when multiple websites exist. Lower values appear first.
3. domain
Type: Char. The website domain (e.g. https://www.mydomain.com). Odoo adds https if missing. It must be unique. Used for routing and SEO.
4. company_id
Type: Many2one (res.company). Required. Links the website to an Odoo company. In multi-company setups, each website shows only company-related data.
5. language_ids
Type: Many2many (res.lang). The languages available on this website. Visitors can switch between them. Defaults to all installed languages.
6. language_count
Type: Integer. Computed. The number of languages. Useful for display and filtering.
7. default_lang_id
Type: Many2one (res.lang). Required. The default language when visitors first land. Must be in language_ids.
8. auto_redirect_lang
Type: Boolean. Default True. When enabled, visitors are redirected to their browser language if it is available.
9. cookies_bar
Type: Boolean. When True, a cookies bar is displayed. Useful for GDPR compliance. Odoo can create a cookie policy page automatically.
10. logo
Type: Binary. The website logo. Displayed in the header and elsewhere. Defaults to the Odoo logo if not set.
11. favicon
Type: Binary. The favicon shown in the browser tab. Odoo resizes it to 256x256.
12. social_twitter
Type: Char. Twitter/X account URL. Defaults from the company. Used in footer and social sharing.
13. social_facebook
Type: Char. Facebook account URL. Same pattern as other social fields.
14. social_linkedin
Type: Char. LinkedIn account URL.
15. social_instagram
Type: Char. Instagram account URL.
16. social_youtube
Type: Char. YouTube account URL.
17. social_github
Type: Char. GitHub account URL.
18. social_tiktok
Type: Char. TikTok account URL.
19. social_default_image
Type: Binary. Default image for social sharing. Overrides the logo when set. Used for Open Graph and Twitter cards.
20. google_analytics_key
Type: Char. Google Analytics key. For tracking. Odoo injects the script when configured.
21. google_maps_api_key
Type: Char. Google Maps API key. For maps and location features.
22. user_id
Type: Many2one (res.users). Required. The public user for this website. Used for portal access and anonymous visitors. Defaults from the company.
23. cdn_activated
Type: Boolean. When True, static assets are served from a CDN. Improves performance.
24. cdn_url
Type: Char. The CDN base URL. Used when cdn_activated is True.
25. cdn_filters
Type: Text. Regex patterns for URLs to rewrite. Defaults to static paths.
26. menu_id
Type: Many2one (website.menu). Computed. The main menu. Points to the root menu item for this website.
27. homepage_url
Type: Char. The homepage path (e.g. /contactus or /shop). Must start with a slash.
28. custom_code_head
Type: Html. Custom code injected in the head. For analytics, scripts, or meta tags.
29. custom_code_footer
Type: Html. Custom code injected in the footer. Useful for chat widgets or tracking.
30. robots_txt
Type: Html. Custom robots.txt content. For SEO and crawler control.
31. theme_id
Type: Many2one (ir.module.module). The installed theme.
32. auth_signup_uninvited
Type: Selection. b2b (On invitation) or b2c (Free sign up). Controls whether visitors can create accounts without an invite.
33. create_date
Type: Datetime. When the record was created. Automatically managed by Odoo.
34. write_date
Type: Datetime. When the record was last modified. Also automatically managed.
How This Model Is Used in Business Workflows
1. Multi-Website and Localization
Companies with multiple brands or regions create one website record per site. Each has its own domain, languages, and content. The website_id field on pages, blogs, and products scopes data to the right site.
2. Branding and Identity
Logo, favicon, and social links are configured per website. Marketing teams update these when rebranding. The social_default_image field improves how links look when shared.
3. Language and SEO
language_ids and default_lang_id control which languages are available. auto_redirect_lang improves UX for international visitors. Proper configuration helps with SEO and hreflang.
4. Performance and CDN
When traffic grows, cdn_activated and cdn_url offload static assets to a CDN. cdn_filters define which URLs are rewritten.
5. Compliance and Analytics
cookies_bar enables the cookie consent banner. google_analytics_key and custom_code_head inject tracking. robots_txt controls crawler access.
How Developers Extend This Model
Developers extend the website model using several patterns. Odoo model inheritance is the main mechanism.
Model Inheritance
Use _inherit = 'website' to extend the model. Add new Odoo fields, override methods, or add constraints. The inherit model in Odoo keeps your changes in a separate module for easy upgrades.
Adding Fields
Define new Odoo fields in your inherited model. Use the right field type: Char, Many2one, Boolean, Integer, Text, Selection. Consider website-dependent fields for multi-website logic.
Python Extensions
Override create, write, or unlink to add logic. Use super() to call the original. Be careful with user_id and company_id when creating websites programmatically.
Odoo Studio
Odoo Studio lets you add fields without code. Good for quick customizations. For complex logic or API-driven configuration, custom modules are more maintainable.
Best Practices
- Set domain for each website in production. It helps routing and SEO.
- Keep default_lang_id within language_ids. Odoo validates this on change.
- Use custom_code_head and custom_code_footer for third-party scripts. Avoid modifying core templates.
- When building API integrations, use the XML-RPC or JSON-RPC API. The website model is fully exposed. Map website_id correctly when syncing content.
- For custom fields, use the
x_prefix or a module prefix to avoid conflicts with future Odoo versions.
Common Mistakes
- Creating duplicate domains. The domain field has a unique constraint.
- Forgetting to set user_id when creating websites via API. It is required.
- Setting homepage_url without a leading slash. Odoo validates and raises an error.
- Enabling cdn_activated without a valid cdn_url. Assets may fail to load.
- Overriding core methods without calling super(). This can break other modules or future upgrades.
Conclusion
The website model is central to site configuration in Odoo. It stores domain, languages, branding, and behavior. Understanding its Odoo fields and how other models reference it will help you configure, customize, and integrate Odoo websites effectively.
Whether you are a functional consultant mapping multi-site needs or a developer building custom modules, a solid grasp of the website model will save time and prevent errors.
Need Help With Your Odoo Implementation ?
Dasolo helps companies implement, customize, and optimize Odoo. We specialize in API integrations and Odoo development. Our team has deep experience with the Odoo data architecture and models like website.
If you need help with your Odoo implementation, multi-website setup, or integrations, we are here to help. Book a demo to discuss your project.