Google Map Odoo Integration
Google maps have multiple use but one of the main use is to find a route between two different locations. We have integrated the Odoo Direction API and places text search to Odoo which can be used to find routes between to locations entered in Odoo.
We have created a new widget as “Google autocomplete”. We can assign this widget to any character field in Odoo. Once this widget is assigned, when user types any data in these fields, Odoo displays some place suggestion from Google maps as shown below:
User can select any of the suggestions listed by the system. On selection of any suggestions a map displays with the pin on the location selected above as shown below:
We have option to select the destination also. Once selected, Odoo will display the possible routes in the map as shown below:
Enabling Widget for Place Auto Completed :
We have added this as a widget. You can enable this widget by passing “widget=google_autocomplete” parameter in any character field. A sample code is given below:
Enabling Map for Google Directions:
In xml file, add a div as follows:
Arguments are as follows:
id: id of the div defined.
- style: the style of the div. This determines the style in which the map that will be displayed including height, width etc.
- src: field name in the view from which the “Source” location in map need to be selected.
- dest: field name in the view from which the “Destination” location in map need to be selected.