Skip to content

Map

A map places one marker per location, labelled with its name and value: sales per branch, per city or per customer state. Markers that sit close together are gathered into a green circle with a count, and split apart as you zoom in.

Sales by Customer State: a map of the United States with markers for Oregon (56.2K), Colorado (45.3K), Minnesota (109.4K) and Massachusetts (118.9K), and green circles with counts where states are grouped

Odoo doesn’t store coordinates for countries or states, and the map has no field to choose them. The dataset must have two columns named exactly lat and lng, holding the latitude and longitude of each row. Rows with no latitude are left off the map.

The usual way is a custom SQL dataset that joins your records to a small list of coordinates. The Sales by Customer State dataset behind this map does it like this (shortened):

SELECT so.date_order::date AS order_date,
st.name AS customer_state,
pt.lat,
pt.lng,
so.amount_untaxed::float8 AS untaxed_amount
FROM sale_order so
JOIN res_partner p ON p.id = so.partner_id
JOIN res_country_state st ON st.id = p.state_id
JOIN (VALUES ('CA', 36.12, -119.68), ('TX', 31.05, -97.56), ('MA', 42.23, -71.53))
AS pt(code, lat, lng) ON pt.code = st.code
WHERE so.state IN ('sale', 'done')

If your branches or warehouses already have coordinates on their address (Odoo’s Partners Geolocation app fills Geo Latitude and Geo Longitude on contacts), select those columns as lat and lng instead.

  1. Click New Item, choose Map and the dataset with lat and lng.

  2. On the Configuration tab, choose the Value Type.

  3. Pick the Category Field: the name shown on each marker, such as the state or branch.

  4. Pick the Measure, unless the Value Type is Count.

  5. Click Save & Preview.

The Configuration tab of the map: Value Type Sum, Category Field customer_state and Measure untaxed_amount

Values on the markers are shortened to K, M and B. Locations with the same name, latitude and longitude are added together into one marker.

Use the + and − buttons or the mouse wheel to zoom, drag to move, and the square button to show the map full screen.

  • Filters: a map uses only its own fixed filters from the Filters tab. Viewers get no filter chips on a map, and the dashboard’s global filters and date filter don’t change it. Put the period in a fixed filter, such as Last 365 days, and say so in the title or tooltip.
  • Drilldown: clicking a marker doesn’t open records.
  • Info tooltip: maps have no ⓘ icon.

The map tiles come from OpenStreetMap, so the people viewing the dashboard need internet access for the map to draw.