Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


db-filter by domain, not for subdomain

on 2/25/14, 5:04 PM 3,906 views

Hello, I have a question, I hope you can help me:

If I want to filter the DB by subdomain, ie: pharmacy.sample.com (select the DB "pharmacy"), cellar.sample.com (select the DB "cellar"), shoe.sample.com (select the DB "shoe").

I use the following: --db-filter=^%d$ And it works great!

But if I require filter the DB by domain, ie: erp.pharmacy.com (select the DB "pharmacy"), erp.cellar.com (select the DB "cellar"), erp.shoe.com (select the DB "shoe").

So what I should put in "--db-filter"?

Reference: help.openerp.com/question/6583/domain-based-db-filter/

Of course, thank you very much for your help and cooperation!

On 5/28/15, 10:47 AM

Hi all,

we find a solution for use %h and subdomain, create your db in replace '.' by '-'.

Example : for the domaine erp.pharmacy.com, create db erp-pharmacy-com

And in your file .conf, at line dbfilter, write this : dbfilter = %h

Works for Odoo v8



| 5 3 8
Pondicherry, India
On 3/25/15, 12:47 AM
Sander Kruger
On 6/22/15, 5:18 AM

I had a similar problem. It is not possible with Odoo to filter db's on anything other than the subdomain or, if the subdomain is 'www', the domain. I wanted to map company domains to different dbs, like this:

http://accounts.company1.com => db = company1

http://accounts.company2.com => db = company2

To fix this, I had to modify the function db_filter in http.py:

if d == "www" and r:


if (d == "www" or d == "accounts") and r:

You can have different prefixes you want.

Jerry P
On 3/24/15, 9:06 PM


I tried using your suggestion of --db-filter=^%h$, but it did not work. From my understanding %h would be "sub.domain.com". I tried creating a database that was  called "domain" and it did not work, so I tried creating "sub.domain.com", but it said that was invalid, so I tried "subdomaincom" and that still did not work, any ideas? (Odoo V8)

UPDATE: I believe this is not possible using only Odoo, I believe you have to use a 3rd party application like Apache or NGINX.

I found this guide for Reverse SSL Proxy with NGINX: http://www.schenkels.nl/2013/01/reverse-ssl-proxy-using-nginx-with-openerp-v7/

Anyone have any documentation relating directly to routing domains? Thanks!

Houssine BAKKALI
On 7/28/14, 10:59 AM

You should select --db-filter=^%h$

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)


Asked: 2/25/14, 5:04 PM
Seen: 3906 times
Last updated: 12/12/15, 10:47 PM