Search 1.9 billion lines of Odoo code on GitHub

web_view_google_map

Author: Open Source Integrators, Odoo Community Association (OCA)
License: AGPL-3
Branch: 12.0
Repository: acsone/geospatial
Dependencies: base_google_map, contacts, and web
Languages: HTML (597, 14.4%), JavaScript (2731, 65.7%), Python (46, 1.1%), Sass (125, 3.0%), XML (169, 4.1%), and reStructuredText (491, 11.8%)
Other branches: 12.0-asw_master, 12.0-mig-geoengine_base_geolocalize, and 14.0
Other repositories: Change2improve/geospatial, CompassionCH/geospatial, Creamaster/geospatial, EBII/geospatial, ERPLibre/geospatial, Gabinete-Digital/geospatial, MYRCONSULTING/geospatial, MathBenTech/geospatial, MrBullfrog/geospatial, NeatNerdPrime/geospatial, OCA-MUK/geospatial, OCA/geospatial, SanteLibre/geospatial, SerpentConsultingServices/geospatial, T2BE/geospatial, TDu/geospatial, agrista/odoo-geospatial, alpham/geospatial, anhvu-sg/geospatial, ateneolab/geospatial, brian10048/geospatial, camptocamp/geospatial, drewes/odoo-geospatial, exosoftware/geospatial, gityopie/geospatial, grindtildeath/geospatial, hassanfadl/geospatial, ideaspositivas-group/geospatial, josueBulle/geospatial, kittikhb/geospatial, kmee/geospatial, leNeo/geospatial, lideritjnma/geospatial, muhammedashraf9244/geospatial, murtuzasaleh/geospatial, richar-osse/geospatial, ruveydayasak/geospatial, sendalpegat/geospatial, sersanchus/geospatial, tarteo/geospatial, usmanmuktar/geospatial, x0rzkov/odoo-geospatial-gis, yanpierchirino/geospatial, yvaucher/geospatial, zarumaru/geospatial, and zoomvr/geospatial

<h1 class="title">Google Map View</h1> <p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/geospatial/tree/12.0/web_view_google_map"><img alt="OCA/geospatial" src="https://img.shields.io/badge/github-OCA%2Fgeospatial-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/geospatial-12-0/geospatial-12-0-web_view_google_map"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/115/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p> <dl class="docutils"> <dt>This module contains three new features:</dt> <dd><ul class="first last simple"> <li>New view type and mode <cite>&quot;map&quot;</cite></li> <li>New widget <cite>&quot;gplaces_address_autocomplete&quot;</cite></li> <li>New widget <cite>&quot;gplaces_autocomplete&quot;</cite></li> </ul> </dd> </dl> <p><strong>Table of contents</strong></p> <div class="contents local topic" id="contents"> <ul class="simple"> <li><a class="reference internal" href="#usage" id="id1">Usage</a></li> <li><a class="reference internal" href="#bug-tracker" id="id2">Bug Tracker</a></li> <li><a class="reference internal" href="#credits" id="id3">Credits</a><ul> <li><a class="reference internal" href="#authors" id="id4">Authors</a></li> <li><a class="reference internal" href="#contributors" id="id5">Contributors</a></li> <li><a class="reference internal" href="#maintainers" id="id6">Maintainers</a></li> </ul> </li> </ul> </div> <a name="usage"></a> <h2><a class="toc-backref" href="#id1">Usage</a></h2> <p>Map view <cite>&quot;map&quot;</cite>:-</p> <p>Basically, this new view <cite>map</cite> will integrate Google Maps into Odoo. Enable you to display <cite>res.partner</cite> geolocation on map or any model contains geolocation. This feature will work seamlessly with Odoo means you can search your partner location using Odoo search feature.</p> <p>There are five available attributes that you can customize:-</p> <blockquote> <ul class="simple"> <li><cite>lat</cite> : an attritube to tell the map the latitude field on the object __[mandatory]__</li> <li><cite>lng</cite> : an attritute to tell the map the longitude field on the object __[mandatory]__</li> <li><cite>color</cite> : an attribute to modify marker color (optional) any given color will set all markers color __[optional]__.</li> <li><cite>colors</cite> : work like attribute <cite>color</cite> but more configurable (you can set marker color depends on it's value) this attribute works similar to <cite>colors</cite> of tree view on Odoo __[optional]__</li> <li><dl class="first docutils"> <dt><cite>library</cite> <span class="classifier-delimiter">:</span> <span class="classifier">an attribute to tell map which map that will be loaded __[mandatory]__.</span></dt> <dd>This options has two values: 1. <cite>geometry</cite> 2. <cite>drawing</cite></dd> </dl> </li> </ul> </blockquote> <p>The XML Map view definitions. For instance:</p> <pre> <code>&lt;record id=&quot;view_res_partner_map&quot; model=&quot;ir.ui.view&quot;&gt; &lt;field name=&quot;name&quot;&gt;view.res.partner.map&lt;/field&gt; &lt;field name=&quot;model&quot;&gt;res.partner&lt;/field&gt; &lt;field name=&quot;arch&quot; type=&quot;xml&quot;&gt; &lt;map class=&quot;o_res_partner_map&quot; library='geometry' string=&quot;Map&quot; lat=&quot;partner_latitude&quot; lng=&quot;partner_longitude&quot; colors=&quot;blue:company_type=='person';green:company_type=='company';&quot;&gt; &lt;field name=&quot;id&quot;/&gt; &lt;field name=&quot;partner_latitude&quot;/&gt; &lt;field name=&quot;partner_longitude&quot;/&gt; &lt;field name=&quot;company_type&quot;/&gt; &lt;field name=&quot;color&quot;/&gt; &lt;field name=&quot;display_name&quot;/&gt; &lt;field name=&quot;title&quot;/&gt; &lt;field name=&quot;email&quot;/&gt; &lt;field name=&quot;parent_id&quot;/&gt; &lt;field name=&quot;is_company&quot;/&gt; &lt;field name=&quot;function&quot;/&gt; &lt;field name=&quot;phone&quot;/&gt; &lt;field name=&quot;street&quot;/&gt; &lt;field name=&quot;street2&quot;/&gt; &lt;field name=&quot;zip&quot;/&gt; &lt;field name=&quot;city&quot;/&gt; &lt;field name=&quot;country_id&quot;/&gt; &lt;field name=&quot;mobile&quot;/&gt; &lt;field name=&quot;state_id&quot;/&gt; &lt;field name=&quot;category_id&quot;/&gt; &lt;field name=&quot;image_small&quot;/&gt; &lt;field name=&quot;type&quot;/&gt; &lt;templates&gt; &lt;t t-name=&quot;kanban-box&quot;&gt; &lt;div class=&quot;oe_kanban_global_click o_res_partner_kanban&quot;&gt; &lt;div class=&quot;o_kanban_image&quot;&gt; &lt;t t-if=&quot;record.image_small.raw_value&quot;&gt; &lt;img t-att-src=&quot;kanban_image('res.partner', 'image_small', record.id.raw_value)&quot;/&gt; &lt;/t&gt; &lt;t t-if=&quot;!record.image_small.raw_value&quot;&gt; &lt;t t-if=&quot;record.type.raw_value === 'delivery'&quot;&gt; &lt;img t-att-src='_s + &quot;/base/static/src/img/truck.png&quot;' class=&quot;o_kanban_image oe_kanban_avatar_smallbox&quot;/&gt; &lt;/t&gt; &lt;t t-if=&quot;record.type.raw_value === 'invoice'&quot;&gt; &lt;img t-att-src='_s + &quot;/base/static/src/img/money.png&quot;' class=&quot;o_kanban_image oe_kanban_avatar_smallbox&quot;/&gt; &lt;/t&gt; &lt;t t-if=&quot;record.type.raw_value != 'invoice' &amp;amp;&amp;amp; record.type.raw_value != 'delivery'&quot;&gt; &lt;t t-if=&quot;record.is_company.raw_value === true&quot;&gt; &lt;img t-att-src='_s + &quot;/base/static/src/img/company_image.png&quot;'/&gt; &lt;/t&gt; &lt;t t-if=&quot;record.is_company.raw_value === false&quot;&gt; &lt;img t-att-src='_s + &quot;/base/static/src/img/avatar.png&quot;'/&gt; &lt;/t&gt; &lt;/t&gt; &lt;/t&gt; &lt;/div&gt; &lt;div class=&quot;oe_kanban_details&quot;&gt; &lt;strong class=&quot;o_kanban_record_title oe_partner_heading&quot;&gt; &lt;field name=&quot;display_name&quot;/&gt; &lt;/strong&gt; &lt;div class=&quot;o_kanban_tags_section oe_kanban_partner_categories&quot;&gt; &lt;span class=&quot;oe_kanban_list_many2many&quot;&gt; &lt;field name=&quot;category_id&quot; widget=&quot;many2many_tags&quot; options=&quot;{'color_field': 'color'}&quot;/&gt; &lt;/span&gt; &lt;/div&gt; &lt;ul&gt; &lt;li t-if=&quot;record.parent_id.raw_value and !record.function.raw_value&quot;&gt; &lt;field name=&quot;parent_id&quot;/&gt; &lt;/li&gt; &lt;li t-if=&quot;!record.parent_id.raw_value and record.function.raw_value&quot;&gt; &lt;field name=&quot;function&quot;/&gt; &lt;/li&gt; &lt;li t-if=&quot;record.parent_id.raw_value and record.function.raw_value&quot;&gt; &lt;field name=&quot;function&quot;/&gt; at &lt;field name=&quot;parent_id&quot;/&gt; &lt;/li&gt; &lt;li t-if=&quot;record.city.raw_value and !record.country_id.raw_value&quot;&gt; &lt;field name=&quot;city&quot;/&gt; &lt;/li&gt; &lt;li t-if=&quot;!record.city.raw_value and record.country_id.raw_value&quot;&gt; &lt;field name=&quot;country_id&quot;/&gt; &lt;/li&gt; &lt;li t-if=&quot;record.city.raw_value and record.country_id.raw_value&quot;&gt; &lt;field name=&quot;city&quot;/&gt; , &lt;field name=&quot;country_id&quot;/&gt; &lt;/li&gt; &lt;li t-if=&quot;record.email.raw_value&quot; class=&quot;o_text_overflow&quot;&gt; &lt;field name=&quot;email&quot;/&gt; &lt;/li&gt; &lt;/ul&gt; &lt;div class=&quot;oe_kanban_partner_links&quot;/&gt; &lt;/div&gt; &lt;/div&gt; &lt;/t&gt; &lt;/templates&gt; &lt;/map&gt; &lt;/field&gt; &lt;/record&gt; &lt;record id=&quot;action_partner_map&quot; model=&quot;ir.actions.act_window&quot;&gt; ... &lt;field name=&quot;view_type&quot;&gt;form&lt;/field&gt; &lt;field name=&quot;view_mode&quot;&gt;tree,form,map&lt;/field&gt; ... &lt;/record&gt;</code> </pre> <p>The marker info window will use <cite>kanban-box</cite> kanban card style.</p> <p>How to setup color for marker on map?</p> <p>There are two attributes:</p> <blockquote> <ul class="simple"> <li><cite>colors</cite>: Allow you to display different marker color to represent a record on map</li> <li><cite>color</cite>: One marker color for all records on map</li> </ul> </blockquote> <p>The XML color view definitions. For instance:</p> <pre> <code>&lt;!-- colors --&gt; &lt;map string=&quot;Map&quot; lat=&quot;partner_latitude&quot; lng=&quot;partner_longitude&quot; colors=&quot;green:company_type=='person';blue:company_type=='company';&quot;&gt; ... &lt;/map&gt; &lt;!-- color --&gt; &lt;map string=&quot;Map&quot; lat=&quot;partner_latitude&quot; lng=&quot;partner_longitude&quot; color=&quot;orange&quot;&gt; ... &lt;/map&gt;</code> </pre> <p>New widget <cite>&quot;gplaces_address_autocomplete&quot;</cite>:-</p> <p>New widget to integrate [Place Autocomplete Address Form](<a class="reference external" href="https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete-addressform">https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete-addressform</a>) in Odoo.</p> <p>The widget has four options that can be modify:</p> <blockquote> <ul class="simple"> <li><cite>component_form</cite></li> <li><cite>fillfields</cite></li> <li><cite>lat</cite></li> <li><cite>lng</cite></li> </ul> </blockquote> <p>Component form <cite>component_form</cite>:-</p> <p>Is an option used to modify which value you want to take from an objects returned by the geocoder. Full documentation about Google component types can be found [here](<a class="reference external" href="https://developers.google.com/maps/documentation/geocoding/intro#Types">https://developers.google.com/maps/documentation/geocoding/intro#Types</a>)</p> <p>By default this option are configured like the following javascript value:</p> <pre> <code>{ 'street_number': 'long_name', 'route': 'long_name', 'intersection': 'short_name', 'political': 'short_name', 'country': 'short_name', 'administrative_area_level_1': 'short_name', 'administrative_area_level_2': 'short_name', 'administrative_area_level_3': 'short_name', 'administrative_area_level_4': 'short_name', 'administrative_area_level_5': 'short_name', 'colloquial_area': 'short_name', 'locality': 'short_name', 'ward': 'short_name', 'sublocality_level_1': 'short_name', 'sublocality_level_2': 'short_name', 'sublocality_level_3': 'short_name', 'sublocality_level_5': 'short_name', 'neighborhood': 'short_name', 'premise': 'short_name', 'postal_code': 'short_name', 'natural_feature': 'short_name', 'airport': 'short_name', 'park': 'short_name', 'point_of_interest': 'long_name' }</code> </pre> <p>This configuration can be modify into xml view field definition:</p> <pre> <code>&lt;record id=&quot;view_res_partner_form&quot; model=&quot;ir.ui.view&quot;&gt; ... &lt;field name=&quot;arch&quot; type=&quot;xml&quot;&gt; ... &lt;field name=&quot;street&quot; widget=&quot;gplaces_address_form&quot; options=&quot;{'component_form': {'street_number': 'short_name'}}&quot;/&gt; ... &lt;/field&gt; &lt;/record&gt;</code> </pre> <p>Fill fields <cite>fillfields</cite>:-</p> <p>Is an option that will be influenced by <cite>gplaces_address_autocomplete</cite> widget.</p> <p>This options should contains known <cite>fields</cite> that you want the widget to fulfill a value for each given field automatically. A field can contains one or multiple elements of component form By default this options are configured like the following javascript value:</p> <pre> <code>{ 'street': ['street_number', 'route'], 'street2': ['administrative_area_level_3', 'administrative_area_level_4', 'administrative_area_level_5'], 'city': ['locality', 'administrative_area_level_2'], 'zip': 'postal_code', 'state_id': 'administrative_area_level_1', 'country_id': 'country', }</code> </pre> <p>This configuration can be modify into xml view field definition as well:</p> <pre> <code>&lt;record id=&quot;view_res_partner_form&quot; model=&quot;ir.ui.view&quot;&gt; ... &lt;field name=&quot;arch&quot; type=&quot;xml&quot;&gt; ... &lt;field name=&quot;street&quot; widget=&quot;google_places&quot; options=&quot;{'fillfields': {'street2': ['route', 'street_number']}}&quot;/&gt; ... &lt;/field&gt; &lt;/record&gt;</code> </pre> <p>Latitude <cite>lat</cite> and Longitude <cite>lng</cite>:-</p> <p>This options tell the widget the fields geolocation, in order to have this fields filled automatically.</p> <p>New widget <cite>&quot;gplaces_autocomplete&quot;</cite>:-</p> <p>New widget to integrate [Place Autocomplete](<a class="reference external" href="https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete">https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete</a>) in Odoo. This widget have similar configuration to <cite>gplaces_address_autocomplete</cite>.</p> <p>Component form <cite>component_form</cite>:-</p> <p>Same configuration of <cite>gplaces_address_autocomplete</cite> component form</p> <p>Fill fields <cite>fillfields</cite>:-</p> <p>This configuration works similar to <cite>gplaces_address_autocomplete</cite>. By default this options are configured like following javascript value:</p> <pre> <code>{ general: { name: 'name', website: 'website', phone: ['international_phone_number', 'formatted_phone_number'] }, geolocation: { partner_latitude: 'latitude', partner_longitude: 'longitude' }, address: { street: ['street_number', 'route'], street2: ['administrative_area_level_3', 'administrative_area_level_4', 'administrative_area_level_5'], city: ['locality', 'administrative_area_level_2'], zip: 'postal_code', state_id: 'administrative_area_level_1', country_id: 'country' } };</code> </pre> <a name="bug-tracker"></a> <h2><a class="toc-backref" href="#id2">Bug Tracker</a></h2> <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/geospatial/issues">GitHub Issues</a>. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed <a class="reference external" href="https://github.com/OCA/geospatial/issues/new?body=module:%20web_view_google_map%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p> <p>Do not contact contributors directly about support or help with technical issues.</p> <a name="credits"></a> <h2><a class="toc-backref" href="#id3">Credits</a></h2> <a name="authors"></a> <h3><a class="toc-backref" href="#id4">Authors</a></h3> <ul class="simple"> <li>Open Source Integrators</li> </ul> <a name="contributors"></a> <h3><a class="toc-backref" href="#id5">Contributors</a></h3> <ul class="simple"> <li>Yopi Angi &lt;<a class="reference external" href="mailto:yopiangi&#64;gmail.com">yopiangi&#64;gmail.com</a>&gt;</li> <li>Wolfgang Hall &lt;<a class="reference external" href="mailto:whall&#64;opensourceintegrators.com">whall&#64;opensourceintegrators.com</a>&gt;</li> <li>Serpent Consulting Services Pvt. Ltd. &lt;<a class="reference external" href="mailto:support&#64;serpentcs.com">support&#64;serpentcs.com</a>&gt;</li> </ul> <a name="maintainers"></a> <h3><a class="toc-backref" href="#id6">Maintainers</a></h3> <p>This module is maintained by the OCA.</p> <a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a> <p>OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.</p> <p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainers</a>:</p> <p><a class="reference external" href="https://github.com/gityopie"><img alt="gityopie" src="https://github.com/gityopie.png?size=40px" /></a> <a class="reference external" href="https://github.com/wolfhall"><img alt="wolfhall" src="https://github.com/wolfhall.png?size=40px" /></a></p> <p>This module is part of the <a class="reference external" href="https://github.com/OCA/geospatial/tree/12.0/web_view_google_map">OCA/geospatial</a> project on GitHub.</p> <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>