Enable Dark Mode!
By: Mily Shajan

How to Create Map Views in Odoo 16?

Technical Odoo 16

Odoo views are a way to display data in the user interface. The views are of different types, each representing a different type of visualization for the users.

Map views are such a kind of view type in Odoo Enterprise that display data on a geographical map. Map views can be created for any model that contains a location field, such as a partner or an event.

Here in this blog, we can discuss How to Create Map Views In Odoo. 

These map views are useful in providing a geographical representation of data, allowing users to visualize and analyze the data in a more intuitive manner.These views can be built dynamically from XML.

In Odoo Enterprise, the Map views can be displayed using the Map widget. Here is the example of Map View in Odoo 16. 

<record id="action_student" model="ir.actions.act_window">
   <field name="name">Student</field>
   <field name="res_model">school.student</field>
   <field name="view_mode">map</field>
   <field name="help" type="html">
       <p class="o_view_nocontent_smiling_face">
           Create School details

First we need to add the map view in view_mode of window action. Here in this school. Student model,  Added the map view in the view mode. And Created the record for Map View as follows

class School(models.Model):
   _name = 'school.student'
   _inherit = ['mail.thread','mail.activity.mixin']

   name = fields.Many2one('res.partner', string='Student',help='Name of the Student')
   admn_code = fields.Char(string='Admn Code', copy=False, readonly=False,
                           index=True, default=lambda self: _('New'))

<record id="student_map" model="ir.ui.view">
   <field name="name">student.map</field>
   <field name="model">school.student</field>
   <field name="arch" type="xml">
       <map res_partner="name" default_order="admn_code" routing="true" hide_name="true">
           <field name="name" string="Student"/>

Here the root element of view is a map. Inside the map(<map>) tag we can add the fields that need to display on the map view.

Within the map tag, we can add several attributes that help to view the records in Map View.


It is the Many2one field of res.partner Model. Here the name, which is a field of Many2one of model res.partner is added to the res_partner attribute of Map View.


This attribute in a map view is used to specify the default sorting order of records displayed in the view. It can be used to sort records based on one or more fields in ascending or descending order. The field admn_code is used in default_order attribute for sorting in this map view.


The routing=True attribute in the Map View in Odoo enables the routing functionality, which allows you to display the shortest route between two or more points on a map. When you set routing=True in the Map View, Odoo will automatically generate a route between the points you specify based on the mapping service you have configured.


This attribute helps to hide the name of the record being displayed on the map.

When the hide_name attribute is set to True, the name of the record will not be displayed on the map. This attribute can be useful in cases where you want to display the location of the record on the map without revealing its identity.


This attribute is used in the map view to hide the title of the map.


This attribute is used in the map view to hide the address of the record being displayed on the map.


This attribute is used in the map view to customize the title of the record's panel that appears on the left-hand side of the map view.

This attribute can be useful in cases where you want to customize the panel's title to provide more meaningful information to the user.

Map view that created for  school.student model shows as follows 


Here, it helps to create map views of the records, which help to access the geographic locations of customers, stores, and other locations in Odoo 16.

If you need any assistance in odoo, we are online, please chat with us.


Leave a comment




Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635



Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.



Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message