Author: |
Yopi Angi |
License: |
no license |
Branch: |
10.0 |
Repository: |
nikeshscs/odoo-addons |
Dependencies: |
base,
web,
website,
and
website_google_map |
Languages: |
CSS (150, 4.4%),
HTML (111, 3.3%),
JavaScript (2367, 69.6%),
Markdown (195, 5.7%),
Python (230, 6.8%),
and
XML (350, 10.3%) |
Other branches: |
11.0-dev,
9.0,
and
master |
Other repositories: |
Andyeyo/Odoo-Addons,
Bilbonet/odoo-addons,
DITIntl/odoo-addons-1,
GiraffosCom/odoo-cl-12,
Gonscar88/odoo-addons,
Guobower/Odoo-Addons-2,
Idealisconsulting/odoo-addons,
Infinityloopsistemas/odoo-addons,
Kalway-Technology/odoo-addons,
KurrufERP/odoo-cl-12,
LevelPrime/odoo-google-maps,
Loo-ERP/odoo-addons,
Manuellama/odoo-addons,
Mefistous/odoo-cl-12,
NivasRaj/odoo-addons,
Normatica/odoo-cl-12,
NothingCtrl/odoo-addons,
OdooBulgaria/Odoo-Addons-17,
OdooBulgaria/odoo-addons-15,
RL-OtherApps/odoo-addons-2,
SDIsl/geolocation,
SantosJMM/odoo-addons,
Sroeurnsuon/odoo-addons,
TheCloneMaster/Odoo-Addons,
UnknownInfo/odoo-cl-12,
Vassy/odoo-addons,
VizThoughts/odoo-addons-2,
abdalmola-apps/odoo-addons,
alvarojimenezpaz/odoo-cl-12,
anhvu-sg/odoo-addons,
aschenkels-ictstudio/odoo-addons-1,
azizulj8/odoo-addons,
be-cloud-be/odoo-addons,
bgavarini/odoo-addons,
bimajatiwijaya/odoo-addons,
bishalgit/odoo-addons,
brain-tec/odoo-addons,
cameleonRuoi/odoo-addons,
consultingerp/crm_maps-12,
daemondev/Odoo-Addons,
dansanti/odoo-addons,
desiteg/odoo-addons,
diegobgl/odoo-addons,
dong-z/odoo-addons,
dtka0105/odoo-addons,
erick-alvino/odoo-addons-1,
erlopezh/odoo-addons,
flectra-chile/odoo-cl-12,
fva-idealis/odoo-addons,
gitstalker/odoo-addons-1,
gityopie/odoo-addons,
grupoebox/odoo-addons,
guohuadeng/odoo-addons,
gustotc/odoo-addons,
halybang/odoo-addons,
hashirharis/odoo-addons,
hippe-67/odoo-addons,
hoangpq/odoo-addons-web-gg,
iledarn/odoo-addons,
intellego-bi/odoo-12,
intellego-bi/odoo-cl-12,
iuppiterpluvius/odoo-addons,
jason156/Odoo-Addons-4,
jeffersonjeff/odoo-addons,
josemoralesp/odoo-addons,
jriveros/odoo-cl-12,
katyukha/odoo-addons,
killteck/odoo-addons,
kit9/odoo-addons-2,
leodoooca/gityopie-odoo-addons,
litnimax/odoo-addons,
marcel1981/odoo-cl-12,
marcelomora/yopie,
marcelsavegnago/odoo-addons-3,
martinllanos/odoo-addons,
maurolguin1/odoo-cl-12,
mgielissen/odoo-addons-7,
minhhq09/odoo-addons,
nerkusoft/odoo-addons,
nextmoveits/odoo-addons,
nguyenductamlhp/odoo-addons,
nick2474/odoo-addons-1,
njeudy/odoo-addons,
nknganda/odoo-addons,
odoochain/odoo-addons,
odoogap/odoo-addons,
odoonz/misc-gityopie,
ohernandez-getinsoft/odoo-addons,
one2pret/odoo-addons,
osvalr/Odoo-Addons,
petypi/odoo-addons-2,
pnajman-modoolar/odoo-addons,
redcor/field-service,
sadeqamin/odoo-addons,
sc4you/odoo-addons-3,
scbrianti/odoo-addons,
sgheller/odoo-addons,
sm2x/odoo-addons,
spoerp/odoo-addons,
t-np/odoo-addons,
tate11/odoo-addons-6,
thanhdongcntt/odoo-addons,
udamuri/odoo-addons,
ursais/odoo-addons,
vidtsin/odoo-cl-12,
wahello/odoo-addons,
westlyou/Odoo-Addons-4,
westlyou/odoo-addons-2,
xpertiz/odoo-addons,
zarumaru/odoo-addons,
and
zoubir/odoo-addons |
<h1>Web Google Maps</h1>
<p><a href="https://youtu.be/2UdG5ILDtiY" title="Demo"><img src="https://i.ytimg.com/vi/2UdG5ILDtiY/3.jpg" alt="Demo"></a> </p>
<p>This module contains three new features:
- New view type and mode (<code>map</code>)
- New widget (<code>gplaces_address_form</code>)
- New widget (<code>gplaces_autocomplete</code>)</p>
<h2>Map view (<code>map</code>)</h2>
<p>Basically, this new view(<code>map</code>) will integrate Google Maps into Odoo.<br>
Enable you to display a partner location or all your partners location around the world on a map.<br>
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:
- <code>lat</code> : an attritube to tell the map the latitude field on the object (mandatory)
- <code>lng</code> : an attritute to tell the map the longitude field on the object (mandatory)
- <code>title</code> : an attribute to tell the map the title that will be printed on marker info window (optional, by default 'name')
- <code>color</code> : an attribute to modify marker color (optional) any given color will set all markers color.
- <code>colors</code> : work like attribute <code>color</code> but more configurable (you can set marker color depends on it's value) this attribute works similar to <code>colors</code> of tree view on Odoo 9.0</p>
<p>How to create the view?<br>
Example</p>
<blockquote>
<pre><code><!-- View -->
<record id="view_partner_map" model="ir.ui.view">
<field name="name">view.partner.map</field>
<field name="model">res.partner</field>
<field name="arch" type="xml">
<!-- Define aliase name for geolocation fields into view attributes -->
<map string="Map" lat="partner_latitude" lng="partner_longitude">
<field name="name"/>
<field name="street"/>
<field name="street2"/>
<field name="city"/>
<field name="zip"/>
<field name="email"/>
<field name="state_id"/>
<field name="country_id"/>
<field name="partner_latitude"/>
<field name="partner_longitude"/>
<templates> <!-- qweb template used for marker infowindow -->
<t t-name="map-marker-iw">
<div class="gm-iw-container o_map_global_click">
<div class="gm-iw-title">
<img t-att-src="map_image('res.partner', 'image_small', record.id.value)"/>
<span><t t-esc="record.name.value"/></span>
</div>
<div class="gm-iw-content">
<p>
<span t-esc="record.street.value"/>&#032;<span t-esc="record.street2.value"/>
</p>
<p>
<span t-esc="record.city.value"/>,&#032;<span t-esc="record.zip.value"/>
</p>
<p>
<span t-esc="record.state_id.value"/>,&#032;<span t-esc="record.country_id.value"/>
</p>
</div>
</div>
</t>
</templates>
</map>
</field>
</record>
</code></pre>
</blockquote>
<pre><code><!-- Action -->
<record id="action_partner_map" model="ir.actions.act_window">
...
<field name="view_type">form</field>
<field name="view_mode">tree,form,map</field>
...
</record>
</code></pre>
<h2>How to setup color for marker on map?</h2>
<p>There are two attributes:
- <code>colors</code>
- <code>color</code> </p>
<p>Example:</p>
<blockquote>
<pre><code><!-- colors -->
<map string="Map" lat="partner_latitude" lng="partner_longitude" colors="green:company_type=='person';blue:company_type=='company';">
...
</map>
</code></pre>
</blockquote>
<pre><code><!-- color -->
<map string="Map" lat="partner_latitude" lng="partner_longitude" color="orange">
...
</map>
</code></pre>
<h2>New widget (<code>gplaces_address_form</code>)</h2>
<p>Basically this new widget will integrate another cool feature of Google Maps which is "Place Autocomplete Address Form" (go and visit this <a href="https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete-addressform">site</a> if you don't know yet how this cool feature work) </p>
<p>The widget has four options that can be modify:
- <code>component_form</code>
- <code>fillfields</code>
- <code>lat</code>
- <code>lng</code></p>
<h3>Component form (<code>component_form</code>)</h3>
<p>Is an option used to modify which value you want to take from an objects returned by the geocoder.<br>
Full documentation about Google component types can be found <a href="https://developers.google.com/maps/documentation/geocoding/intro#Types">here</a></p>
<p>By default this option are configured like following value:</p>
<blockquote>
<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>
</blockquote>
<p>This configuration can be modify into view field definition.<br>
Example:</p>
<blockquote>
<pre><code><record id="view_res_partner_form" model="ir.ui.view">
...
<field name="arch" type="xml">
...
<field name="street" widget="gplaces_address_form" options="{'component_form': {'street_number': 'short_name'}}"/>
...
</field>
</record>
</code></pre>
</blockquote>
<h3>Fill fields (<code>fillfields</code>)</h3>
<p>Is an option that will be influenced by <code>gplaces_address_form</code> widget.<br>
This options should contains known <code>fields</code> that you want to set a value for each field automatically.<br>
A field can contains one or multiple elements of component form<br>
By default this options are configured like following value:</p>
<blockquote>
<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>
</blockquote>
<p>This configuration can be modify into view field definition as well<br>
Example:</p>
<blockquote>
<pre><code><record id="view_res_partner_form" model="ir.ui.view">
...
<field name="arch" type="xml">
...
<field name="street" widget="google_places" options="{'fillfields': {'street2': ['route', 'street_number']}}"/>
...
</field>
</record>
</code></pre>
</blockquote>
<h3>Latitude (<code>lat</code>) and Longitude (<code>lng</code>)</h3>
<p>This options tell the widget the fields geolocation, in order to have this fields filled automatically.</p>
<h2>New widget (<code>gplaces_autocomplete</code>)</h2>
<p>Basically this new widget will integrate another cool feature of Google Maps which is "Place Autocomplete" (go and visit this <a href="https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete">site</a> if you don't know yet how this cool feature work) </p>
<p>This widget have similar configuration to <code>gplaces_address_form</code>.</p>
<h3>Component form (<code>component_form</code>)</h3>
<p>Same configuration of <code>gplaces_address_form</code> component form</p>
<h3>Fill fields (<code>fillfields</code>)</h3>
<p>This configuration works similar to <code>gplace_address_form</code>.</p>
<p>By default this options are configured like following value:</p>
<blockquote>
<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>
</blockquote>
<h1>Technical:</h1>
<p>This module will install <code>website_google_maps</code>.<br>
<em>I recommend you to add Google Maps Key API into Odoo Website Admin settings when you installed this module</em></p>
<p>The goal of this module is to bring the power of Google Maps into Odoo<br>
This module has tested on Odoo Version 10.0c </p>
<p>You can buy me a cup of <a href="http://ko-fi.com/yopiangi">☕</a>, if you want to support me to keep this project maintained. Thanks :)</p>
<p>Regards,<br>
Yopi<br>
yopiangi@gmail.com</p>