[IMP] developer/views: update map doc

This commit updates the documentation of the map view.
There were missing map attributes, typos and wrong descriptions.

closes odoo/documentation#1253

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
This commit is contained in:
Michael (mcm) 2021-11-02 09:12:48 +00:00
parent bd2fe4a6fe
commit 1ea99ca48c

View File

@ -1925,49 +1925,51 @@ Map
<span class="badge" style="background-color:#AD5E99">Enterprise feature</span>
This view is able to display records on a map and the routes between them. The record are represented by pins. It also allows the visualization of fields from the model in a popup tied to the record's pin.
This view is able to display records on a map and the routes between them. The records are represented by pins. It also allows the visualization of fields from the model in a popup tied to the record's pin.
.. note::
The model on which the view is applied should contains a res.partner many2one since the view relies on the res.partner's address and coordinates fields to localize the records.
The model on which the view is applied should contain a `res.partner` many2one since the view relies on the `res.partner`'s address and coordinates fields to localize the records.
.. _reference/views/map/api:
Api
API
~~~
The view uses location data platforms' api to fetch the tiles (the map's background), do the geoforwarding (converting addresses to a set of coordinates) and fetch the routes.
The view implements two api, the default one, openstreet map is able to fetch `tiles`_ and do `geoforwarding`_. This api does not require a token.
As soon as a valid `MapBox`_ token is provided in the general settings the view switches to the Mapbox api. This api is faster and allows the computation of routes. The token are available by `signing up`_ to MapBox
The view uses location data platforms' API to fetch the tiles (the map's background), do the geoforwarding (converting addresses to a set of coordinates) and fetch the routes.
The view implements two API, OpenStreetMap and MapBox. OpenStreetMap is used by default and is able to fetch `tiles`_ and do `geoforwarding`_. This API does not require a token.
As soon as a valid `MapBox`_ token is provided in the general settings the view switches to the MapBox API. This API is faster and allows the computation of routes. A token can be obtained by `signing up`_ to MapBox.
.. _reference/views/structural components:
Structural components
~~~~~~~~~~~~~~~~~~~~~
The view's root element is ``<map>`` multiple attributes are allowed
The view's root element is ``<map>``. It can have the following attributes:
``res_partner``
Contains the res.partner many2one. If not provided the view will resort to create an empty map.
Contains the `res.partner` many2one. If not provided the view resorts to create an empty map.
``default_order``
If a field is provided the view will override the model's default order. The field must be part of the model on which the view is applied not from res.partner
If a field is provided the view overrides the model's default order. The field must be part of the model on which the view is applied, not from `res.partner`.
``routing``
if ``true`` the routes between the records will be shown. The view still needs a valid MapBox token and at least two located records. (i.e the records has a res.partner many2one and the partner has a address or valid coordinates)
if ``true`` display the routes between the records. The view needs a valid MapBox token and at least two located records (i.e the records have a `res.partner` many2one and the partner has an address or valid coordinates).
``hide_name``
if ``true`` hide a name from the marker's popup (default: false)
if ``true`` hide the name from the pin's popup (default: ``false``).
``hide_address``
if ``true`` hide a address from the marker's popup (default: false)
if ``true`` hide the address from the pin's popup (default: ``false``).
``hide_title``
if ``true`` hide the title from the pin list (default: ``false``).
``panel_title``
String to display as title of the pin list. If not provided, the title is the action's name or "Items" if the view is not in an action.
``limit``
Maximum number of records to fetch (default: 80). It must be a positive integer.
The ``<map>`` element can contain multiple ``<field>`` elements. Each ``<field>`` element will be interpreted as a line in the marker's popup. The field's attributes are the following:
The ``<map>`` element can contain multiple ``<field>`` elements. Each ``<field>`` element is interpreted as a line in the pin's popup. The field's attributes are the following:
``name``
The field to display.
``string``
This string will be displayed before the field's content. It Can be used as a description.
``limit``
The size of a page (default: 80). It must be a positive integer.
No attribute or element is mandatory but as stated above if no res.partner many2one is provided the view won't be able to locate records.
String to display before the field's content. It can be used as a description.
For example here is a map:
.. code-block:: xml