Pular para o conteúdo
Documentação do usuário

Geo IP

Instalação

  1. Download both the GeoLite2 City and Country databases. You should end up with two files called GeoLite2-City.mmdb and GeoLite2-Country.mmdb.

  2. Move the files to the folder /usr/share/GeoIP/.

    mv ~/Downloads/GeoLite2-City.mmdb /usr/share/GeoIP/
    mv ~/Downloads/GeoLite2-Country.mmdb /usr/share/GeoIP/
  3. Restart the server

Testar a geolocalização GeoIP no Odoo Site

Edite uma página da web para incluir algumas informações de geo-ip, como o nome do país do endereço IP da solicitação atual. Para isso:

  1. Go to your website. Open the web page that 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.geoip.country.name or 'geoip failure'"/>
  4. Save and refresh the page.

Se o nome do seu país estiver exibido em negrito no meio da página, o Geo-ip está funcionando.

Se, em vez disso, aparecer "falha de geoip", a geolocalização falhou. As causas comuns são:

  1. The browsing IP address is the localhost (127.0.0.1) or a local area network one. If you don't know, you can access your website using mobile data.

  2. You are using a reverse-proxy (apache, nginx) in front of Odoo but didn't start Odoo with the proxy-mode enabled. See proxy mode <odoo-bin --proxy-mode>.

  3. The GeoIP database is corrupt, missing or unaccessible. In such case a warning was logged in the server logs.