$ 5.87
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Lines of code | 1780 |
| Technical Name |
grev_od_map_view |
| License | OPL-1 |
| Website | https://www.grevlin.com |
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Lines of code | 1780 |
| Technical Name |
grev_od_map_view |
| License | OPL-1 |
| Website | https://www.grevlin.com |
Advanced Map ViewA first-class Odoo map view type — fullscreen, picture-in-picture, side list panel, road-snapped asset routes, click-to-create and a form-view field widget
|
|
|
1. Basic map view
Then add 2. Asset routes — origin & destination
Selecting a record in the side list draws its journey on the map —
a solid road-snapped line from origin to current
position (the done leg), and a dashed line
from current position to destination (the remaining leg).
The four
3. Embed the map inside a form —
|
<field name="current_lat" widget="grev_map_location"
options="{
'lng_field': 'current_lng',
'zoom': 14,
'tile_layer': 'carto_voyager',
'height': 360,
'origin_lat_field': 'origin_lat',
'origin_lng_field': 'origin_lng',
'destination_lat_field': 'dest_lat',
'destination_lng_field': 'dest_lng',
}"/>
|
The grev_map_location widget is bound to the
latitude field; the longitude companion is passed via
the lng_field option. When the field is editable, clicking
the map updates both coordinates on the record. The four optional
origin_* / destination_* options paint the
same done/remaining route overlay as the map view, so a single field
turns any form into a tracking dashboard.
|
|
|
Need Help?For support, contact us at odoo@grevlin.com Follow us on X: @GrevlinGlobal ✨ 30 days free support included |
Advanced Map View - Documentation
A first-class Odoo view type that renders any model with latitude and longitude fields on an interactive Leaflet map — with fullscreen, picture-in-picture, area zoom, ordered route polylines and a click-to-measure distance tool.
Overview
Advanced Map View registers a new grev_map view type alongside Odoo's standard list, kanban and form views. It plugs into the view-switcher, breadcrumbs, search panel and pager exactly like a native view, so any model that exposes geographic coordinates can gain a fully featured map UI without a single line of JavaScript.
The module ships only the view type itself — it has no opinions about which records you map. Point it at customers, fleet vehicles, deliveries, sensors, project sites, rental assets or any custom model.
Key Features
- Native ``grev_map`` view type — declared like list or kanban in any ir.actions.act_window view mode
- Fullscreen mode — expand the map to the entire viewport for monitoring
- Picture-in-picture — detach the map into a floating window that stays visible while you work elsewhere in Odoo
- Side list panel — built-in left panel listing every record on the map; click an item to fly to its marker and open its popup
- Click-to-create — hit :guilabel:`+ New` and click on the map to open a form prefilled with the latitude and longitude of that point
- Area zoom — drag a rectangle to zoom precisely to a region
- Distance tool — click successive points to measure distances using the haversine formula, with running totals
- Route polylines — draw an ordered path through records using a timestamp field
- Asset routes (origin → current → destination) — declare origin and destination fields to render the done leg as a solid road-snapped line and the remaining leg as a dashed line through the asset's current position; powered by leaflet-routing-machine and OSRM, with a per-leg straight-polyline fallback
- Color by field — colour markers by a selection or many2one field
- Rich popups — declare <field> children to render contextual information for each record both in the side panel and the marker popup
- Form-view field widget — the companion grev_map_location widget embeds a Leaflet map directly inside any form view, with optional click-to-set editing and the same asset-route overlay
- Five built-in tile layers — CARTO Voyager, Positron, Dark Matter, OpenStreetMap and OpenStreetMap HOT
Note
This module is compatible with both Odoo Community and Odoo Enterprise editions. It depends only on base and web — there is no Enterprise-only requirement and no CDN dependency for the Leaflet library.
Installation
- Copy the grev_od_map_view module into your Odoo addons path
- Update the apps list from :menuselection:`Apps --> Update Apps List`
- Search for Advanced Map View and click :guilabel:`Install`
Usage
Declaring a Map View
Create an ir.ui.view record whose architecture root is <grev_map> and reference it from any window action. The two attributes lat_field and lng_field are required.
<record id="view_partner_grev_map" model="ir.ui.view"> <field name="name">res.partner.grev.map</field> <field name="model">res.partner</field> <field name="arch" type="xml"> <grev_map lat_field="partner_latitude" lng_field="partner_longitude" color_field="category_id" default_zoom="6" panel_title="Partners"> <field name="display_name"/> <field name="city"/> <field name="country_id"/> </grev_map> </field> </record>
Then add grev_map to the action's view_mode:
<record id="action_partner_map" model="ir.actions.act_window"> <field name="name">Partners on Map</field> <field name="res_model">res.partner</field> <field name="view_mode">grev_map,list,form</field> </record>
Supported Attributes
The <grev_map> root tag accepts the following attributes:
| Attribute | Required | Description |
|---|---|---|
| lat_field | Yes | Float field holding the latitude of each record |
| lng_field | Yes | Float field holding the longitude of each record |
| timestamp_field | No | Date/datetime field used to order records when routing="1" |
| color_field | No | Selection or many2one field driving the marker colour |
| routing | No | Set to "1" to draw a polyline through ordered records |
| default_zoom | No | Initial Leaflet zoom level (default 13) |
| tile_layer | No | One of carto_voyager (default), carto_positron, carto_dark, osm, osm_hot |
| panel_title | No | Title shown at the top of the side panel |
| limit | No | Page size for the side panel (default 200) |
| hide_list | No | Set to "1" to hide the side list panel even on multi-record views |
| origin_lat_field | No | Float field with the asset's origin latitude (asset-route overlay) |
| origin_lng_field | No | Float field with the asset's origin longitude (asset-route overlay) |
| destination_lat_field | No | Float field with the asset's destination latitude (asset-route overlay) |
| destination_lng_field | No | Float field with the asset's destination longitude (asset-route overlay) |
<field> children declared inside <grev_map> are loaded with the records and shown both in the side panel and in the marker popup.
Note
The four origin_*_field / destination_*_field attributes work as a set: the asset-route overlay only renders when the four are configured together and all four fields hold numeric values on the active record.
Asset Routes (Origin → Current → Destination)
When origin and destination fields are declared, selecting a record in the side list paints its journey on the map:
- A solid road-snapped line from origin to current position — the done leg.
- A dashed road-snapped line from current position to destination — the remaining leg.
Routing uses the public OSRM service via leaflet-routing-machine. If the service is unreachable for a leg, that leg falls back to a straight polyline in the same colour and dash pattern.
Form-View Field Widget — grev_map_location
The module also registers a field widget called grev_map_location that embeds a Leaflet map directly inside a form view. The widget is bound to the latitude field; the longitude companion is provided through options.
<field name="current_lat" widget="grev_map_location" options="{ 'lng_field': 'current_lng', 'zoom': 14, 'tile_layer': 'carto_voyager', 'height': 360, 'origin_lat_field': 'origin_lat', 'origin_lng_field': 'origin_lng', 'destination_lat_field': 'dest_lat', 'destination_lng_field': 'dest_lng', }"/>
Supported widget options:
| Option | Required | Description |
|---|---|---|
| lng_field | Yes | Companion float field holding the longitude |
| zoom | No | Initial zoom level (default 13) |
| tile_layer | No | One of carto_voyager (default), carto_positron, carto_dark, osm |
| height | No | Map height in pixels (default 320) |
| origin_lat_field / origin_lng_field | No | Origin coordinates — required as a pair to enable the route overlay |
| destination_lat_field / destination_lng_field | No | Destination coordinates — required as a pair to enable the route overlay |
Tip
When the latitude field is editable on the form, clicking anywhere on the map updates both the latitude and the longitude on the record. In read-only contexts the click handler is disabled and the map becomes a pure visualisation.
Click-to-Create
The toolbar includes a :guilabel:`+ New` button that activates a single-shot drop a pin mode. The next click on the map opens the model's standard form view with the latitude and longitude fields prefilled at the clicked point. The button respects the standard create arch attribute, so you can disable it on read-only dashboards via <grev_map create="0" ...>.
Map Toolbar
Once a grev_map view is open, the floating toolbar offers:
- :guilabel:`+ New` — activate click-to-create; the next click on the map opens a form prefilled with that point's coordinates
- :guilabel:`Side List` — show or hide the left-hand record list
- :guilabel:`Fullscreen` — toggle the immersive fullscreen mode
- :guilabel:`Picture-in-Picture` — detach the map into a draggable floating window
- :guilabel:`Area Zoom` — activate drag-rectangle zoom mode
- :guilabel:`Measure Distance` — click successive points to measure haversine distances
- :guilabel:`Reset View` — restore the default zoom and bounds
Tip
The picture-in-picture window survives navigation, so you can keep an eye on live records while editing forms in another tab of the same Odoo session.
Compatibility
- Odoo: 19.0 (Community and Enterprise)
- Dependencies: base, web
- Vendored library: Leaflet (no external CDN required at runtime — tile layers are fetched from CARTO and OpenStreetMap public endpoints)
Support
For questions, bug reports or feature requests, contact odoo@grevlin.com or follow @GrevlinGlobal on X.
Thirty days of free support are included with every purchase.
Odoo Proprietary License v1.0 This software and associated files (the "Software") may only be used (executed, modified, executed after modifications) if you have purchased a valid license from the authors, typically via Odoo Apps, or if you have received a written agreement from the authors of the Software (see the COPYRIGHT file). You may develop Odoo modules that use the Software as a library (typically by depending on it, importing it and using its resources), but without copying any source code or material from the Software. You may distribute those modules under the license of your choice, provided that this license is compatible with the terms of the Odoo Proprietary License (For example: LGPL, MIT, or proprietary licenses similar to this one). It is forbidden to publish, distribute, sublicense, or sell copies of the Software or modified copies of the Software. The above copyright notice and this permission notice must be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Please log in to comment on this module