Real Multi Website

by ,
Odoo 1
v 10.0 Third Party 9

400.00 €

Add to Cart Live Preview
Technical name website_multi_company
LicenseLGPL-3
Included Dependencies Website Multi Theme

Real Multi Website

Set up Multi-Websites, Multi-Theme, Multi-eCommerce, Multi-Company on a single database

Key features:
  • 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
  • compatible with multi-company
  • use any domains for websites (not only subdomains)

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.mycompany.local
  • samsung.mycompany.local
  • xiaomi.mycompany.local


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.

Free Support

You will get free support and assistance in case of any issues

Tested on Odoo
10.0 community
Tested on Odoo
10.0 enterprise

Real Multi Website

Installation

Firstly install the external dependencies:

apt-get install ruby-compass
gem install compass bootstrap-sass

Then install this module in a usual way.

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
    

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

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
  • database name: example.org
    • host names:
      • shop1.example.org
      • shop2.example.org
      • shop3.example.org

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 following line to your nginx config (other webservers are supported too - see description of dbfilter_from_header):

proxy_set_header 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
  • database name: delivery_business

    • host names:
      • pizzas.example
      • china-food.example
  • 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;
      }
     }
    

Configuration

  • Enable technical features
  • At Settings >> Users menu and activate Multi Companies and set Allowed Companies
  • Open menu Website Admin >> 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
    • Multi Theme -- select a theme you wish to apply for website, e.g. theme_bootswatch (if you install any of supported themes after installing this module, you should click on Reload button to be able to use them)
Note that to use Multi Theme feature you should have the latest updates of Odoo or at least include the following 3 commits:

To apply them you can use git commands or use patch file commits-for-multitheme.patch. The patch can be found at module source. Exact commands are as following:

If odoo is a git folder:

cd /path/to/odoo/source
git fetch
git cherry-pick 15bf41270d3abb607e7b623b59355594cad170cf
git cherry-pick 7c6714d7fee4125f037ef194f9cff5235a6c5320
git cherry-pick 48fe0a595308722a26afd5361432f24c610b4ba0

if your installation does not have git:

cd /path/to/odoo/source
patch -p1 < /path/to/commits-for-multitheme.patch

Website Menus

You can edit, duplicate or create new menu at Website Admin >> Configuration >> Website Menus -- pay attention to fields Website, Parent Menu. In most cases, Parent Menu is a Top Menu (i.e. menu record without Parent Menu value). If a website doesn't have Top Menu you need to create one.

Note. Odoo doesn't share Website Menus (E.g. Homepage, Shop, Contact us, etc.) between websites. So, you need to have copies of them.

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
  • open HOST1/shop, make order, open backend -- created order belongs to COMPANY1
  • open HOST2/shop, make order, open backend -- created order belongs to COMPANY2

Please log in to comment on this module

Odoo
Demo system availability
by on

Is there a system where you could test the features? Further couple of questions: 1. Can you have common pages between different websites or are all pages website specific? 2. Obviously you can use different websites under the same company? 3. Could you setup the "different websites" behind language selection? This would basically mean that user could have different contend depending on the selected website language.

Odoo
well done Module
by on

this module fullfill the advertised features, an a happy user of it now.