Filtering Odoo Databases by Domain Name with dbfilter: A Step-by-Step Guide

Odoo is a beautiful multi-tenant system. You can serve as many clients as you want with a single code base. In Odoo, every client has his own database in Postgres, and data are not shared amount clients. Our preferred version of odoo is the V14 community edition because we have many clients and customs modules written for them. In a single VPS server, we have one source code of odoo14 and roughly 8 clients on every server.

What is the problem?

As a multi-tenant system, when you open your Odoo instance from the main domain, you have the listing of all the databases as shown in the following picture.

Odoo database selector
Odoo database selector

Each client should then select their corresponding database and log in to perform their daily business operation.

Client 1 database select in odoo
Client 1 database select in odoo

In our situation, our client shouldn’t be aware of the existence of the database of other persons on that server. Also, should be able to only access their database with their domain name. Imagine you can know that we also host the database of your main competitors on the same server :joy:.

What I was asking to do?

In my early days in the team as a newbie odoo developer, my supervisor asked me to find a way to get rid of this problem. Our boss didn’t want that anymore. So I search the internet and found an interesting blog post explaining database filtering in Odoo. It is worth it to read that short blog post.

My task was to filter the database listing base on the domain name. I learned there that odoo offer two types of a regular expression to filter databases:

If you want to know a more advanced way to filter databases in odoo, read trobz blog post where I learned dB filtering in Odoo. I only cover what I used (%h) and how I used it to solve my problem.

My usage of %h to filter databases in Odoo?

The first thing to do is to configure every client domain name to point to the same Odoo instance. For example, if you have erp.client1.net and my.client2.org, both should be pointed to the same Odoo instance.

The second step is to create the database of the client with the same name as their domain name. The following picture show to you what I am saying.

The third and last step is to add the following entry in your odoo.conf file and restart your server.

dbfilter = %h

Voilà. You have successfully applied database filtering in your odoo instance based on the domain name in the URL.

Additional note

  • %h means everything starting with the hostname. If I create another database with the name erp.client1.net_demo, this database will be displayed when you will access erp.client1.net domain name
  • %h$ is used for exact matching. This will only allow the listing of the database with the same name as the domain name.

Wrap up

In this short blog post, I shared with you how I managed to apply dB filtering in our Odoo instances based on the domain name. I hope this will help you. If you like the type of content I share, consider subscribing to my newsletter to don’t miss any content I pop out.

If you have an incomprehension with my explanation, leave a comment and I would clarify that part. Thanks for reading.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top
porn by force indianhub.me indian girls fuck photos
kannada auntys sex videos ounoun.com indian local sex videos com
kolkata teen sex indianporncave.mobi telugu xxx .com
gotporn redwap3.com indian men naked
m taxi 69 hotindiantube.net incent porn
indian awesome sex tryporn.net xnll
gand porn analpornstars.info xnxx jabardasti
dj-punjab.in xxxvideohd.info mp3 hindi mp3
home sex malayalam pornstarsporn.info indian sex vid
download indian girl sex video indiapornfilm.pro desi xvedios
ndiansex babezporn.com unexpected sex
xvideo plumber xxx-tube-list.net kannada real sex
sexy video rap arabpornsamples.com poonam pandey xvideo
softcore 69 tryporno.net fuck.sc
shemalexnxx screwmyindianwife.info desi choda video