Enable Dark Mode!
how-to-create-map-views-in-odoo-17.jpg
By: Jumana Jabin MP

How to Create Map Views in Odoo 17

Technical Odoo 17

Views in Odoo serve as a means to present data in the user interface. There are several sorts of views, each reflecting a particular type of visualization for the users. Map views in Odoo Enterprise are specialized view types designed to showcase data on a geographical map. Models featuring location fields, such as partners or events, can seamlessly incorporate map views.

This blog post will guide you through the process of crafting Map Views in Odoo 17.

These map views prove to be highly effective for offering a visual representation of data based on geographical locations, providing users with an intuitive means to observe and analyze the information. These views may be dynamically generated using XML.

The Map widget in Odoo Enterprise may be used to display Map views. Here's a sample of Map View in Odoo 17

<record id="resistance_id" model="ir.actions.act_window">
   <field name="name">Resistance</field>
   <field name="type">ir.actions.act_window</field>
   <field name="res_model">resistance.fail.pass</field>
   <field name="view_mode">tree,form,map</field>
</record>

First, we must include the map view in the window action's view_mode.  In a Resistance model,  The map view has been added to the view mode. And I made the following record for Map View:

<record id="ress_map" model="ir.ui.view">
   <field name="name">resistance.fail.pass.map</field>
   <field name="model">resistance.fail.pass</field>
   <field name="arch" type="xml">
       <map res_partner="name" routing="true"
            hide_name="true">
           <field name="name" string="Customer"/>
       </map>
   </field>
</record>

A map serves as the primary element of view in this case. We can include the fields intended for display on the map view within the <map> tag.

We may add numerous properties to the map tag that will assist us in displaying the entries in the Map display.

Res_partner 

It is the res.partner Model's Many2one field. The "name" field, belonging to the Many2one model res.partner, is incorporated into the res_partner property of the Map View.

Default_order

In a map view, this property is used to set the default sorting order of the entries presented in the view. It can be employed to arrange entries either in ascending or descending order, depending on one or more fields.

Routing

The routing=True feature in Odoo's Map View enables routing capability, allowing you to display the quickest path between two or more places on a map. Odoo will automatically build a route between the places you designate when you set routing=True in the Map View.

Hide_name

This property assists in hiding the name of the record displayed on the map.

Hide_title 

In the map view, this property is used to conceal the map's title.

Hide_address

In the map view, this feature is used to conceal the address of the record displayed on the map.

Panel_title

This attribute is utilized within the map view to personalize the title of the record's panel, visible on the left-hand side of the map view.

This feature is important when you wish to customize the title of the panel to offer more meaningful information to the user.

For this model, I designed a map view. The Resistance model is as follows: 

how-to-create-map-views-in-odoo-17-1-cybrosys

It proves beneficial to create map views for records in Odoo 17, facilitating access to the geographical locations of customers, stores, and various other places.

To read more about creating map views in Odoo 16, refer to our blog How to Create Map Views in Odoo 16


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



0
Comments



Leave a comment



whatsapp
location

Calicut

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

location

Kochi

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

location

Bangalore

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

Send Us A Message