[ADD] integration: geolocation

task-3694395

closes odoo/documentation#7971

X-original-commit: 74978109ee
Signed-off-by: Xavier Platteau (xpl) <xpl@odoo.com>
This commit is contained in:
Marion (masp) 2024-02-13 14:28:14 +01:00 committed by Xavier (XPL)
parent 680573ff40
commit 4efd4c2788
5 changed files with 65 additions and 21 deletions

View File

@ -12,6 +12,7 @@ Miscellaneous
general/reporting general/reporting
general/email_communication general/email_communication
general/voip general/voip
general/geolocation
general/digest_emails general/digest_emails
general/in_app_purchase general/in_app_purchase
general/developer_mode general/developer_mode

View File

@ -0,0 +1,39 @@
===========
Geolocation
===========
You can locate contacts or places and generate routes on a map in Odoo.
.. image:: geolocation/contacts.png
:alt: Map displaying a contact's location.
To use the feature, open the :guilabel:`Settings` app, and, under the :guilabel:`Integrations`,
section, activate :guilabel:`Geo Localization`. Then, choose between using the OpenStreetMap or
Google Places API.
**OpenStreetMap**
OpenStreetMap is a free, open geographic database updated and maintained by volunteers. To use it,
select :guilabel:`Open Street Map`.
.. important::
OpenStreetMap might not always be accurate. You can `join the OpenStreetMap community
<https://www.openstreetmap.org/fixthemap>`_ to fix any issues encountered.
**Google Places API map**
The Google Places API map provides detailed info on places, businesses, and points of interest. It
supports location-based features like search, navigation, and recommendations.
.. important::
Using the Google Places API could require `payment to Google
<https://mapsplatform.google.com/pricing/>`_.
To use it, select :guilabel:`Google Place Map` and enter your :ref:`API Key
<address_autocomplete/generate_api_key>`.
.. image:: geolocation/google-places-api-key.png
:alt: Google Places API key
.. seealso::
:doc:`../../applications/websites/website/configuration/address_autocomplete`

Binary file not shown.

After

Width:  |  Height:  |  Size: 385 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@ -2,9 +2,10 @@
Address autocomplete Address autocomplete
==================== ====================
You can use the Google Places API on your website to ensure that your users' delivery addresses exist and are understood You can use the Google Places API on your website to ensure that your users' delivery addresses
by the carrier. The Google Places API allows developers to access detailed information about places using HTTP requests. exist and are understood by the carrier. The Google Places API allows developers to access detailed
The autocompletion predicts a list of places when the user starts typing the address. information about places using HTTP requests. The autocompletion predicts a list of places when the
user starts typing the address.
.. image:: address_autocomplete/address-autocomplete-example.png .. image:: address_autocomplete/address-autocomplete-example.png
:alt: Address autocomplete example :alt: Address autocomplete example
@ -14,26 +15,29 @@ The autocompletion predicts a list of places when the user starts typing the add
- `Google Developers Documentation: Google Places API - `Google Developers Documentation: Google Places API
<https://developers.google.com/maps/documentation/places/web-service/autocomplete>`_ <https://developers.google.com/maps/documentation/places/web-service/autocomplete>`_
To do so, go to :menuselection:`Website --> Configuration --> Settings` and enable
To do so, go to :menuselection:`Website --> Configuration --> Settings` and enable :guilabel:`Address Autocomplete` in :guilabel:`Address Autocomplete` in the :guilabel:`SEO` section.
the :guilabel:`SEO` section.
.. image:: address_autocomplete/enable-address-autocomplete.png .. image:: address_autocomplete/enable-address-autocomplete.png
:alt: Enable address autocomplete :alt: Enable address autocomplete
Insert your :guilabel:`Google Places API key` in the :guilabel:`API Key` field. If you don't have one, create yours on Insert your :guilabel:`Google Places API key` in the :guilabel:`API Key` field. If you don't have
the `Google Cloud Console <https://console.cloud.google.com/getting-started>`_ and follow these steps. one, create yours on the `Google Cloud Console <https://console.cloud.google.com/getting-started>`_
and follow these steps.
.. _address_autocomplete/generate_api_key:
Step 1: Enable the Google Places API Step 1: Enable the Google Places API
==================================== ====================================
| **Create a New Project:** **Create a New Project:**
| To enable the **Google Places API**, you first need to create a project. To do so, click :guilabel:`Select a project` To enable the **Google Places API**, you first need to create a project. To do so, click
in the top left corner, :guilabel:`New Project`, and follow the prompts to set up your project. :guilabel:`Select a project` in the top left corner, :guilabel:`New Project`, and follow the prompts
to set up your project.
| **Enable the Google Places API:** **Enable the Google Places API:**
| Go to the :guilabel:`Enabled APIs & Services` and click :guilabel:`+ ENABLE APIS AND SERVICES.` Search for Go to the :guilabel:`Enabled APIs & Services` and click :guilabel:`+ ENABLE APIS AND SERVICES.`
:guilabel:`"Places API"` and select it. Click on the :guilabel:`"Enable"` button. Search for :guilabel:`"Places API"` and select it. Click on the :guilabel:`"Enable"` button.
.. note:: .. note::
Google's pricing depends on the number of requests and their complexity. Google's pricing depends on the number of requests and their complexity.
@ -43,16 +47,16 @@ Step 2: Create API Credentials
Go to `APIs & Services --> Credentials <https://console.cloud.google.com/apis/credentials>`_. Go to `APIs & Services --> Credentials <https://console.cloud.google.com/apis/credentials>`_.
| **Create credentials:** **Create credentials:**
| To create your credentials, go to :guilabel:`Credentials`, click :guilabel:`Create Credentials`, and select To create your credentials, go to :guilabel:`Credentials`, click :guilabel:`Create Credentials`, and
:guilabel:`API key`. select :guilabel:`API key`.
.. admonition:: Restrict the API Key (Optional) .. admonition:: Restrict the API Key (Optional)
For security purposes, you can restrict the usage of your API key. You can go to the :guilabel:`API restrictions` For security purposes, you can restrict the usage of your API key. You can go to the
section to specify which APIs your key can access. For the Google Places API, you can restrict it to only allow :guilabel:`API restrictions` section to specify which APIs your key can access. For the Google
requests from specific websites or apps. Places API, you can restrict it to only allow requests from specific websites or apps.
.. important:: .. important::
- Save Your API Key: Copy your API key and securely store it. - Save Your API Key: copy your API key and securely store it.
- Do not share it publicly or expose it in client-side code. - Do not share it publicly or expose it in client-side code.