Real Multi Website
by IT-Projects LLC https://twitter.com/yelizariev , Ivan Yelizariev https://twitter.com/yelizariev , Nicolas JEUDY https://twitter.com/yelizariev$ 317.17
Required Apps |
Website Builder (website)
|
Included Dependencies | Show |
Lines of code | 2595 |
Technical Name |
website_multi_company |
License | See License tab |
Website | https://twitter.com/yelizariev |
Also available in version | v 13.0 v 10.0 v 12.0 |
Required Apps |
Website Builder (website)
|
Included Dependencies | Show |
Lines of code | 2595 |
Technical Name |
website_multi_company |
License | See License tab |
Website | https://twitter.com/yelizariev |
Also available in version | v 13.0 v 10.0 v 12.0 |
Real Multi Website
Set up Multi-Websites, Multi-Theme, Multi-eCommerce, Multi-Company on a single database
Version: v11.0.3.0.1
Tested and maintained by
IT Projects Labs
Assitance: help@itpp.dev
- multiple websites in a single database
- easy to add new websites
- easy to create website menus
- use different design (themes) per each website
- multi-eCommerce
- multi-payment (different payment methods per each company)
- compatible with multi-company
- use any domains for websites (not only subdomains)
- All features of Email Addresses and Templates per Website module
The module allows to set up multiple websites on a single database and handles requests in a different company context. It is especially useful for eCommerce to make orders for different companies.
Odoo has been designed to switch website by host name, but this feature is not completed and not supported. This module fills the gap.
How It Works
Go to Website Admin → Configuration → Websites menu and add websites.

In the website creation form specify Website Name, Website Domain (e.g. apple.mycompany.local, samsung.mycompany.local, etc), choose Website Theme you wish, upload a favicon and other fields if needed. Also you will be able to specify company name if your user has ``Multi Companies`` access rights.

You can easily create menus for your websites in Website Admin → Configuration → Website Menus

Open each website and design it whatever you like. Then go to any of them and be sure that each one has own description, own products at shop, etc.
As an example you can see 3 websites below:
Apple Website <apple.mycompany.local>
If a customer open apple.mycompany.local, he can see for example:
Apple Homepage

Apple Shop (it contains apple devices only)

If a customer make an order at Apple Shop, the created sale order will belong to the associated company - Company 1
Sale Order


Samsung Website <samsung.mycompany.local>
If a customer open samsung.mycompany.local, he can see for example:
Samsung Homepage

Samsung Shop (it contains samsung devices only)

If a customer make an order at Samsung Shop, the created sale order will belong to the associated company - Company 2
Sale Order


Xiaomi Website <xiaomi.mycompany.local>
If a customer open xiaomi.mycompany.local, he can see for example:
Xiaomi Homepage

Xiaomi Shop (it contains xiaomi devices only)

If a customer make an order at Xiaomi Shop, the created sale order will belong to the associated company - Company 3
Sale Order


As a result you can see different websites for different companies in your database.
Multi-payment settings
Note that you can use different payment acquirers per each website. Let's consider how to setup 2 different paypal accounts for 2 different websites.
Go to Invoicing → Configuration → Payments Acquirers and open Paypal acquier form. Click on the Action ⇒ Duplicate button to create the second one



Detailed instruction about how to configure Paypal account and get Paypal Identity Token you can find here
Free Support
You will get free support and assistance in case of any issues
Want to take a look?
For a live demostration click LIVE PREVIEW button above (near to Add to Cart)
Let our expertise work for you!
(Doors and windows below are clickable)
/itpp-labs-1100.jpg)
/itpp-labs-930.jpg)
/itpp-labs-690.jpg)
Real Multi Website
Installation
Dependencies
apt-get install ruby-compass gem install compass bootstrap-sass
Odoo version
Please use up-to-date version of odoo or at least be sure, that your odoo has following updates:
- 26 Jun 2018: https://github.com/odoo/odoo/commit/5cecd0a197eba847e4a71bea3a31584d2b88ea6b
Additional modules
Due to technical reasons some multi-website features are located in separate modules, install them depending on your needs:
- if you use website_sale (eCommerce) module, then install Real Multi Website (eCommerce extension) too
- if you use website_portal (Portal) module, then install Real Multi Website (portal extension) too
Domain Names
You will be able to use any website domain names (not only subdomains), e.g. shop1.com, shop2.com, etc. In this case you need to setup DNS entries on your DNS hosting provider.
For example:
shop1.com:
@ A your_server_ip_address
shop2.com:
@ A your_server_ip_address
Web Server
Your webserver (e.g. Apache or Nginx) must pass header Host to odoo, otherwise there is no way to define which website is used. Required configuration for Nginx and Apache looks as following:
Nginx:
proxy_set_header Host $host;
Apache:
ProxyPreserveHost On
Single database deployment
No updates in odoo config is required if you use only one database.
Multi database deployment
For multi-database instance odoo has to know which database to use when handle new request without session information. There are two ways to do it:
- Let user select database manually (bad user experience)
- Take database depending on host name (prefered)
In the latter case dbfilter is usually used, though it's not flexible enough.
Using dbfilter parameter
For TESTING purpose you can use the following configuration:
- dbfilter: ^%d$
- database name: example
- host names:
- example.shop1.local
- example.shop2.local
- example.shop3.local
- host names:
Patching http.py
For PRODUCTION deployment with websites on subdomains you can use following patch. You need to update odoo/http.py file as following:
# updated version of db_filter def db_filter(dbs, httprequest=None): httprequest = httprequest or request.httprequest h = httprequest.environ.get('HTTP_HOST', '').split(':')[0] d, _, r = h.partition('.') t = r if d == "www" and r: d, _, t = r.partition('.') r = odoo.tools.config['dbfilter'].replace('%h', h).replace('%d', d).replace('%t', t) dbs = [i for i in dbs if re.match(r, i)]
Then you can use following configuration
- dbfilter: ^%t$
- database name: example.com
- host names:
- shop1.example.com
- shop2.example.com
- shop3.example.com
- host names:
- database name: example.org
- host names:
- shop1.example.org
- shop2.example.org
- shop3.example.org
- host names:
Using dbfilter_from_header module
Most flexible way to deploy multi-database system is using dbfilter_from_header (check module description for installation instruction).
In short, you need to add special line to your webserver config (other webservers are supported too - see description of dbfilter_from_header):
Nginx:
proxy_set_header X-Odoo-dbfilter [your filter regex]
Apache:
Header add X-ODOO_DBFILTER [your filter regex] RequestHeader add X-ODOO_DBFILTER [your filter regex]
Note, that you probably need to set usual db_filter to .*, because dbfilter_from_header module uses that filter first and then applies filter from header.
Example (we use top level domain .example due to copyright issues, but it could be any top level domains at any combinations):
dbfilter: .*
database name: software_business
- host names:
- miscrosoft-products.example
- antivirus.example
- android.antivirus.example
- host names:
database name: delivery_business
- host names:
- pizzas.example
- china-food.example
- host names:
Nginx:
server { listen 80; server_name miscrosoft-products.example antivirus.example android.antivirus.example; proxy_set_header Host $host; proxy_set_header X-Odoo-dbfilter ^software_business\Z; location /longpolling { proxy_pass http://127.0.0.1:8072; } location / { proxy_pass http://127.0.0.1:8069; } } server { listen 80; server_name pizzas.example china-food.example; proxy_set_header Host $host; proxy_set_header X-Odoo-dbfilter ^delivery_business\Z; location /longpolling { proxy_pass http://127.0.0.1:8072; } location / { proxy_pass http://127.0.0.1:8069; } }
Apache:
<VirtualHost *:80> ServerName miscrosoft-products.example antivirus.example android.antivirus.example ProxyPreserveHost On Header add X-ODOO_DBFILTER "software_business" RequestHeader add X-ODOO_DBFILTER "software_business" ProxyPass / http://127.0.0.1:8069/ ProxyPassReverse / http://127.0.0.1:8069/ ProxyPass /longpolling/ http://127.0.0.1:8072/longpolling/ ProxyPassReverse /longpolling/ http://127.0.0.1:8072/longpolling/ </VirtualHost> <VirtualHost *:80> ServerName pizzas.example china-food.example ProxyPreserveHost On Header add X-ODOO_DBFILTER "delivery_business" RequestHeader add X-ODOO_DBFILTER "delivery_business" ProxyPass / http://127.0.0.1:8069/ ProxyPassReverse / http://127.0.0.1:8069/ ProxyPass /longpolling/ http://127.0.0.1:8072/longpolling/ ProxyPassReverse /longpolling/ http://127.0.0.1:8072/longpolling/ </VirtualHost>
Odoo.sh deployment
In the manager of your domain name registrar you need to add CNAME records for your domains (subdomains), for example:
- Create a CNAME record shop1.example.org pointing to <yourdatabase>.odoo.com
- Create a CNAME record shop2.example.org pointing to <yourdatabase>.odoo.com
- Create a CNAME record example.com pointing to <yourdatabase>.odoo.com
Similar for dev and staging database, but use corresponding domain in odoo.com, e.g. mywebsite-master-staging-12345689.dev.odoo.com
Translation issue
Check this section if you use translations in odoo.
Odoo may have wrong translations, which leads to the error Translation is not valid. You need either fix the translations or apply following workaround:
open file odoo/addons/base/ir/ir_translation.py
comment out @api.constraints... near def _check_value, that is you shall get something like this (pay attention to # symbol):
#@api.constrains('type', 'name', 'value') def _check_value(self): for trans in self.with_context(lang=None):
Configuration
- Enable technical features
- At [[ Settings ]] >> Users >> Users menu and activate Multi Companies and set Allowed Companies
- Open menu [[ Website ]] >> Configuration >> Websites
- Create or select a website record
- Update fields:
- Website Domain -- website address, e.g. shop1.example.com
- Company -- which company is used for this website
- Favicon -- upload website favicon
- Base Url -- Currently it's used only for switching between websites on frontend. You must specify entire URL with http:// or https:// depending on whether your connection secured or not, for example:
- http://shop1.example.com/
- http://shop1.example.com/
- https://shop2.example.com/
- Multi Theme -- select a theme you wish to apply for website, e.g. theme_bootswatch
- Click on Reload Themes button before using new theme
- For unofficial themes extra actions are required as described below
Multi-theme
After installing theme, navigate to [[ Website ]] >> Configuration >> Multi-Themes. Check that the theme is presented in the list, otherwise add one.
Note: themes that depend on theme_common don't work in demo installation. To avoid this, you have to create database without demo data or comment out demo files in __manifest__.py file of theme_common module like this:
'demo': [ # 'demo/demo.xml', ],
Convert view to multi-website view
When you have custom module which adds some page, you can easily convert to a multi-website view, i.e. it will have different versions of the page per each website. There are two ways to do that.
Convert to multi-website view via Editor
- Open some page in Frontend with Developer Mode activated, e.g. /?debug
- Click Customize -> HTML/CSS Editor
- Select some view without suffix (Website #...)
- Click button [Convert to Multi-Website]
Convert to multi-website view via Backend
You need to know so called xml_id, which has following format: <MODULE_NAME>.<VIEW_NAME>. Once you know that do as following:
- Activate Developer Mode
- Navigate to [[ Website ]] >> Configuration >> Multi-Themes
- Choose Default Theme
- In Views fields use Create and Edit... to add record:
- Name: use xml_id of the view
- Check that field Theme is set to Default Theme
- Click [Save]
- Click [Save] at the theme view
- Navigate to [[ Website ]] >> Settings
- Click Reload Theme List & Update all websites
- RESULT: page with the view may be edited independently
Note, that you have to be sure, that each Website uses Default Theme directly or indirectly (via Sub-themes field).
Usage
For all examples below:
- configure some WEBSITE1 for HOST1 and COMPANY1
- configure some WEBSITE2 for HOST2 and COMPANY2
Steps for Website
- open HOST1/
- add Text block "text1" to Home Page
- open HOST2/ -- you don't see "text1"
- add Text block "text2" to Home Page
- open HOST1/ -- you see "text1" and don't see "text2"
The same works if you create new page, new menu
Steps for eCommerce
- install website_shop (eCommerce) module
- open Invoicing >> Configuration >> Payments Acquirers and create payments acquirers per each company
- use [Action] -> Duplicate button
- don't forget to click [Unpublished On Website] button to activate it
- open [[ Sales ]] >> Products and create product per each company if they don't exist. If a product doesn't belong to any company (i.e. "Company" field is empty), this product will be available on each website you created.
- open HOST1/shop, make order, open backend -- created order belongs to COMPANY1
- open HOST2/shop, make order, open backend -- created order belongs to COMPANY2
Multi-payment
Note that you are able to use different payment acquiers per each company.
E.g. to use different Paypal accounts for different websites you need to make the following steps:
- go to [[ Invoicing ]] >> Configuration >> Payments Acquirers
- open Paypal acquirer and duplicate it by clicking [Action] -> Duplicate
- for the first one set Company 1, for the second - Company 2
- specify the credentials provided for each acquirer:
- Paypal Email ID
- Paypal Merchant ID
- Paypal PDT Token
Follow the instruction to know how to configure Paypal account and get Paypal Identity Token
The MIT License (MIT) Copyright 2020 IT-Projects Labs Copyright 2015-2020 IT-Projects LLC Copyright 2015 Ivan Yelizariev Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Please log in to comment on this module
Report comment
Any abuse of this reporting system will be penalizedThere are no ratings yet!
Missing Dependencies?
When I download the module for V11 and unzip the file there are two modules: 1) website_multi_company 2) website_multi_theme The dependencies listed but are missing are: 1) ir_rule_website 2) ir_config_parameter_multi_company 3) mail_multi_website 4) web_website
There is server crashes cause of module ir_config_parameter_multi_company, need support
Hello, I need your support, when I try to reinstall this module, it crashes server and coudn't start again, giving error about csrf_token missing. We are not at all satisfied after installation. I traced and found out that, this is cause of value column touch, in that module. Could not understand why that is needed to rename column and drop that column. I think this is a Bug and should be resolved asap. You can email me: chandni.machchhar3@gmail.com Waiting for your response. Thanks.
Live preview does not works
I'm trying to test the Live preview but it still ending up in a 404 page.
Live preview button ends in 404 page not found
I want to try the live preview option but the button ends up in a 404 page not found page. Please advise.
Demo is working
Demo is working. If you have a problem with getting demo or any other questions please contact us by email apps@it-projects.info
Your Login and demo link is not working
I have check on "Live Preview " button next to But button but i can not open demo link properly i have need to check link immediately. Forward me link @ following Address. expertodoo@gmail.com
No straight forward implementation
I have server which as multiple databases. One of the database will use this module for multi-company and multi-website. I purchased the module but I can't solve its problems I need detailed support for this module (wmarzouk@technotown.technology)
please support me about this module
please support me about this module my email: son.maingoc.erp@gmail.com