Geo IP installation (on-premises database) - Odoo 13.0


  1. Install geoip2 Python library
    pip install geoip2
  2. Download the GeoLite2 City database. You should end up with a file called GeoLite2-City.mmdb
  3. Move the file to the folder /usr/share/GeoIP/
    mv ~/Downloads/GeoLite2-City.mmdb /usr/share/GeoIP/
  4. Restart the server

How to test GeoIP geolocation in your Odoo website?

  1. Go into your website. Open the web page on which you want to test GeoIP.
  2. Choose Customize ‣ HTML/CSS/JS Editor.
  3. Add the following piece of XML in the page :
<h1 class="text-center" t-esc="request.session.get('geoip')"/>

You should end up with a dictionary indicating the location of the ip address.