| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Lines of code | 1530 |
| Technical Name |
viin_web_map |
| License | OPL-1 |
| Website | https://viindoo.com/apps/app/17.0/viin_web_map |
| Versions | 13.0 14.0 15.0 16.0 17.0 18.0 |
Base Module for Map Visualization in Odoo
Viin Map View is a foundational module enabling map-based visualization for various records in Odoo, such as contacts, employees, or custom routes. This module focuses on providing a flexible and customizable interface for integrating geographic data and map providers into Odoo views.
Key Features
- Location Display: Markers for records with latitude and longitude.
- Routing Support: Visualize routes between waypoints with optional polylines.
- Customizable Popups: Define information displayed in marker popups.
- Flexible Providers: Compatible with OpenStreetMap, Google, Mapbox, and HERE.
Demo Video: Viin Map View
Usage Notes
This module only provides the core map interface (view). Specific functionalities, such as integrating contacts or employees with maps, require additional modules. For example:
- To show contacts on the map, a separate integration module must link the viin_web_map interface with the contacts model.
- Demo videos use such integration modules to showcase functionality beyond the scope of this module.
Examples
Displaying Locations
Example configuration for res.partner:
<record id="res_partner_view_map" model="ir.ui.view"> <field name="name">res.partner.view.map</field> <field name="model">res.partner</field> <field name="arch" type="xml"> <viin_map res_partner="id"> <marker-popup> <field name="name" string="Name"/> <field name="mapping_address" string="Address"/> </marker-popup> </viin_map> </field> </record>
Displaying Employees
Example configuration for hr.employee:
<record id="hr_employee_view_viin_map" model="ir.ui.view"> <field name="name">hr.employee.view.viin_map</field> <field name="model">hr.employee</field> <field name="arch" type="xml"> <viin_map res_partner="address_home_id"> <marker-popup> <field name="name" string="Name" /> <field name="address_home_id" string="Address" /> </marker-popup> </viin_map> </field> </record>
Displaying Routes
Example configuration for route.route:
<record id="view_route_route_map" model="ir.ui.view"> <field name="name">route.route.viin_map</field> <field name="model">route.route</field> <field name="arch" type="xml"> <viin_map res_partner="address_from_id" routing="true" waypoint_field="waypoint_ids"> <marker-popup> <field name="code" string="Ref."/> <field name="mapping_address" string="Instructions"/> </marker-popup> </viin_map> </field> </record>
Editions Supported
- Community Edition
viin_web_map Documentation
Overview
The viin_web_map module allows you to integrate interactive maps into your Odoo system. It provides functionality for displaying locations and routes directly on the map, making it ideal for location-based applications. The module allows you to configure and visualize both individual locations (using markers) and routes (using waypoints).
Key Features
- Location Display: Display location data using markers on the map.
- Route Visualization: Visualize routes between multiple waypoints.
- Customizable Popups: Customize the information shown in map marker popups.
- Google Directions: Optionally show directions using the Google Directions API.
- Automatic Polyline Generation: Polyline is automatically generated from waypoints if not explicitly defined.
- Flexible Configuration: Easily configure and extend the map to suit your needs.
Installation
Install the viin_web_map module via the Odoo Apps interface or using the following command:
odoo-bin -c <config_file> -i viin_web_map
Configure the Maps API key for one of the map service providers - Mapbox, Google, or HERE - if you want to use the location services provided by them.
Usage
Configuring the viin_map View
The viin_map view can be used to display locations or routes on the map. Below are examples of how to configure the view for different use cases.
### Displaying Location Data
To display locations as markers on the map, you can configure the viin_map view for a model like res.partner. The view will display each partner as a marker on the map with relevant information shown in a popup.
Example of a viin_map view displaying locations:
<record id="res_partner_view_map" model="ir.ui.view"> <field name="name">res.partner.view.map</field> <field name="model">res.partner</field> <field name="arch" type="xml"> <viin_map res_partner="id"> <marker-popup> <field name="name" string="Name"/> <field name="mapping_address" string="Address"/> </marker-popup> </viin_map> </field> </record>
Explanation: - res_partner="id": The map uses the id field from the res.partner model to locate the partner on the map. - marker-popup: Specifies the fields to show in the marker popup, in this case, the partner’s name and mapping_address.
### Displaying Routes
To display a route between multiple waypoints, you can configure the viin_map view with the routing="true" attribute. If the polyline field is not explicitly defined, it will be automatically generated from the waypoints.
Example of a viin_map view displaying a route:
<record id="view_route_route_map" model="ir.ui.view"> <field name="name">route.route.viin_map</field> <field name="model">route.route</field> <field name="arch" type="xml"> <viin_map res_partner="address_from_id" routing="true" waypoint_field="waypoint_ids" polyline_field="polyline"> <field name="waypoint_ids" /> <field name="polyline" /> <marker-popup> <field name="code" string="Ref."/> <field name="mapping_address" string="Instructions"/> </marker-popup> </viin_map> </field> </record>
Explanation: - routing="true": Enables the route functionality, allowing the map to display a route between multiple waypoints. - waypoint_field="waypoint_ids": Defines the field that holds the list of waypoints used to calculate the route. - polyline_field="polyline": Optional. If omitted, the polyline will be auto-generated from the waypoints. - field name="waypoint_ids": Displays all the waypoints on the map.
### Automatically Generating Polyline from Waypoints
When you configure a route with waypoints but do not specify a polyline field, the polyline is automatically generated based on the coordinates of the defined waypoints. This allows you to visualize the route without manually defining the polyline.
Example:
<record id="view_route_route_map_auto_polyline" model="ir.ui.view"> <field name="name">route.route.viin_map.auto_polyline</field> <field name="model">route.route</field> <field name="arch" type="xml"> <viin_map res_partner="address_from_id" routing="true" waypoint_field="waypoint_ids"> <field name="waypoint_ids" /> <marker-popup> <field name="code" string="Ref."/> <field name="mapping_address" string="Instructions"/> </marker-popup> </viin_map> </field> </record>
### Required Fields for Routing
When using routing="true", the following fields are required: - waypoint_field: Defines the waypoints for the route. - res_partner: Always mandatory in all viin_map views.
If polyline_field is not specified, it is automatically generated from the waypoints.
Error Handling
Ensure all required fields are defined in the viin_map view. Missing required fields, such as waypoint_field, will result in validation errors.
Customizing the Map View
You can customize the map by adding or modifying fields in the marker-popup or by introducing additional attributes to the viin_map tag.
Example of a custom map view:
<record id="view_custom_route_map" model="ir.ui.view"> <field name="name">route.route.custom_map</field> <field name="model">route.route</field> <field name="arch" type="xml"> <viin_map res_partner="address_from_id" routing="true" waypoint_field="waypoint_ids"> <field name="waypoint_ids" /> <field name="custom_field" string="Custom Info"/> <marker-popup> <field name="code" string="Ref."/> <field name="mapping_address" string="Instructions"/> <field name="custom_field" string="Additional Information"/> </marker-popup> </viin_map> </field> </record>
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