Managing multiple websites
Odoo has built-in support for multiple websites. This means that the same Odoo instance can be run on multiple domains as well as when displaying different records.
Getting ready
For this recipe, we will be using the my_hostel
module from the previous recipe. In this recipe, we will hide hostels based on the website.
How to do it...
Follow these steps to make the online website multi-website compatible:
- Add
website.multi.mixin
in thehostel.hostel
model, as follows:class Hostel(models.Model): Â Â Â Â Â _name = 'hostel.hostel' Â Â Â Â Â _description = "Information about hostel" Â Â Â Â Â _inherit = ['website.seo.metadata', 'website.multi.mixin'] ...
- Add
website_id
in the hostel form view, as follows:... <group> Â Â Â Â <field name="website_id"/> </group> ...
- Modify the domain in the
/hostels...