Real Multi Website

by , ,
Odoo          
v 11.0 Third Party 58

490.00 €

Live Preview
Technical name website_multi_company
LicenseLGPL-3
Websitehttps://twitter.com/yelizariev
Read description for v 10.0
Included Dependencies Multi-website support in Security Rules
Context-dependent values in System Parameters
Website Switcher in Backend
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
  • multi-payment (different payment methods per each company)
  • 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.

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

  • For Paypal 1: set Company 1 and provided credentials

  • For Paypal 2: set Company 2 and provided credentials

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)

Tested on Odoo
11.0 community
Tested on Odoo
11.0 enterprise

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:

Additional modules

Due to technical reasons some multi-website features are located in separate modules, install them depending on your needs:

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

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 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
  • 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;
      }
     }
    

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
    • 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

Website Menus

You can edit, duplicate or create new menu at [[ Website ]] >> Configuration >> 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.

Multi-theme

After installing theme, navigate to [[ Website ]] >> Configuration >> Multi-Themes. Check that the theme is presented in the list, otherwise add one.

If you get error The style compilation failed, add modules to Dependencies field. It allows to attach theme-like dependencies to corresponding theme and prevent themes compatibility problems.

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

Please log in to comment on this module

Odoo
There is server crashes cause of module ir_config_parameter_multi_company, need support
by on

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.

Odoo
Live preview does not works
by on

I'm trying to test the Live preview but it still ending up in a 404 page.

Odoo
Live preview button ends in 404 page not found
by on

I want to try the live preview option but the button ends up in a 404 page not found page. Please advise.

Odoo
Demo is working
by on

Demo is working. If you have a problem with getting demo or any other questions please contact us by email apps@it-projects.info

Odoo
Your Login and demo link is not working
by on

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

Odoo
No straight forward implementation
by on

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)

Odoo
please support me about this module
by on

please support me about this module my email: son.maingoc.erp@gmail.com