Author: |
Yopi Angi |
License: |
AGPL-3 |
Branch: |
14.0 |
Repository: |
brain-tec/odoo-addons |
Dependencies: |
base,
base_geolocalize,
base_setup,
and
web |
Languages: |
HTML (92, 2.5%),
JavaScript (2798, 75.6%),
Markdown (243, 6.6%),
Python (202, 5.5%),
Sass (132, 3.6%),
and
XML (235, 6.3%) |
Other branches: |
10.0,
11.0,
11.0-glang,
11.0-widget_google_autocomplete,
12.0,
12.0-#120,
12.0-autocomplete-dev,
12.0-dev,
12.0-dev-widget,
12.0-draggable-marker,
12.0-gmap-lang,
13.0,
13.0-dev,
13.0-website-gautocomplete,
14.0-16102021,
14.0-dev,
14.0-dev-10202021,
14.0-edit-geolocation,
14.0-fix-inconsistent-map-focus,
14.0-map-theme,
14.0-meeting-maps,
14.0-toggle-sidebar,
14.0-update-markerclusterer,
15.0,
15.0-dev,
15.0-fix-inconsistent-map-focus,
15.0-google_map_inline,
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,
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,
nikeshscs/odoo-addons,
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>This module contains three new features:
- New view type and mode <code>"google_map"</code>
- New widget <code>"gplaces_address_autocomplete"</code>
- New widget <code>"gplaces_autocomplete"</code></p>
<h1>Map view <code>"google_map"</code></h1>
<p>Basically, this new view <code>map</code> will integrate Google Maps into Odoo.<br>
Enable you to display <code>res.partner</code> geolocation on map or any model contains geolocation.<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 <strong>[mandatory]</strong>
- <code>lng</code> : an attritute to tell the map the longitude field on the object <strong>[mandatory]</strong>
- <code>color</code> : an attribute to modify marker color (optional) any given color will set all markers color <strong>[optional]</strong>.
- <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 <strong>[optional]</strong>
- <code>library</code> : an attribute to indicates which google map library to load.<br>
This options has two values:<br>
1. <code>geometry</code> [default]
2. <s><code>drawing</code></s></p>
<h3>How to create the view?</h3>
<p>Example
```xml
<!-- View -->
<record id="view_res_partner_map" model="ir.ui.view">
<field name="name">view.res.partner.map</field>
<field name="model">res.partner</field>
<field name="arch" type="xml">
<google_map class="o_res_partner_map" library="geometry" string="Map" lat="partner_latitude" lng="partner_longitude" colors="blue:company_type=='person';green:company_type=='company';">
<field name="id"/>
<field name="partner_latitude"/>
<field name="partner_longitude"/>
<field name="color"/>
<field name="display_name"/>
<field name="title"/>
<field name="email"/>
<field name="parent_id"/>
<field name="is_company"/>
<field name="function"/>
<field name="phone"/>
<field name="street"/>
<field name="street2"/>
<field name="zip"/>
<field name="city"/>
<field name="country_id"/>
<field name="mobile"/>
<field name="state_id"/>
<field name="category_id"/>
<field name="image_128"/>
<field name="type"/>
<field name="company_type"/>
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_global_click o_kanban_record_has_image_fill o_res_partner_kanban">
<t t-if="!record.is_company.raw_value">
<t t-if="record.type.raw_value === 'delivery'" t-set="placeholder" t-value="'/base/static/img/truck.png'"/>
<t t-elif="record.type.raw_value === 'invoice'" t-set="placeholder" t-value="'/base/static/img/money.png'"/>
<t t-else="" t-set="placeholder" t-value="'/base/static/img/avatar_grey.png'"/>
<div class="o_kanban_image_fill_left d-none d-md-block" t-attf-style="background-image:url('#{kanban_image('res.partner', 'image_128', record.id.raw_value, placeholder)}')">
<img class="o_kanban_image_inner_pic" t-if="record.parent_id.raw_value" t-att-alt="record.parent_id.value" t-att-src="kanban_image('res.partner', 'image_128', record.parent_id.raw_value)"/>
</div>
<div class="o_kanban_image rounded-circle d-md-none" t-attf-style="background-image:url('#{kanban_image('res.partner', 'image_128', record.id.raw_value, placeholder)}')">
<img class="o_kanban_image_inner_pic" t-if="record.parent_id.raw_value" t-att-alt="record.parent_id.value" t-att-src="kanban_image('res.partner', 'image_128', record.parent_id.raw_value)"/>
</div>
</t>
<t t-elif="record.image_128.raw_value">
<t t-set="placeholder" t-value="'/base/static/img/company_image.png'"/>
<div class="o_kanban_image_fill_left o_kanban_image_full" t-attf-style="background-image: url(#{kanban_image('res.partner', 'image_128', record.id.raw_value, placeholder)})" role="img"/>
</t>
<div class="oe_kanban_details">
<strong class="o_kanban_record_title oe_partner_heading"><field name="display_name"/></strong>
<div class="o_kanban_tags_section oe_kanban_partner_categories"/>
<ul>
<li t-if="record.parent_id.raw_value and !record.function.raw_value"><field name="parent_id"/></li>
<li t-if="!record.parent_id.raw_value and record.function.raw_value"><field name="function"/></li>
<li t-if="record.parent_id.raw_value and record.function.raw_value"><field name="function"/> at <field name="parent_id"/></li>
<li t-if="record.city.raw_value and !record.country_id.raw_value"><field name="city"/></li>
<li t-if="!record.city.raw_value and record.country_id.raw_value"><field name="country_id"/></li>
<li t-if="record.city.raw_value and record.country_id.raw_value"><field name="city"/>, <field name="country_id"/></li>
<li t-if="record.email.raw_value" class="o_text_overflow"><field name="email"/></li>
</ul>
<div class="oe_kanban_partner_links"/>
</div>
</div>
</t>
</templates>
</google_map>
</field>
</record></p>
<pre><code><!-- Action -->
<record id="action_partner_map" model="ir.actions.act_window">
...
<field name="view_mode">kanban,tree,form,google_map</field>
...
</record>
</code></pre>
<p>```</p>
<p>The view looks familiar?<br>
Yes, you're right.<br>
The marker infowindow will use <code>kanban-box</code> kanban card style. </p>
<h3>How to setup color for marker on map?</h3>
<p>There are two attributes:
- <code>colors</code><br>
Allow you to display different marker color to represent a record on map
- <code>color</code><br>
One marker color for all records on map</p>
<p>Example:
```xml
<!-- colors -->
<google_map string="Map" lat="partner_latitude" lng="partner_longitude" colors="green:company_type=='person';blue:company_type=='company';">
...
</google_map></p>
<pre><code><!-- color -->
<google_map string="Map" lat="partner_latitude" lng="partner_longitude" color="orange">
...
</google_map>
</code></pre>
<p>```</p>
<h1>New widget <code>"gplaces_address_autocomplete"</code></h1>
<p>New widget to integrate <a href="https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete-addressform">Place Autocomplete Address Form</a> in Odoo.<br>
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>
By default this option are configured like the following value
<code>javascript
{
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',
floor: 'short_name',
establishment: 'short_name',
point_of_interest: 'short_name',
parking: 'short_name',
post_box: 'short_name',
postal_town: 'short_name',
room: 'short_name',
bus_station: 'short_name',
train_station: 'short_name',
transit_station: 'short_name',
}
</code>
This configuration can be modify into view field definition.<br>
Example:
<code>xml
<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></p>
<h3>Fill fields <code>fillfields</code></h3>
<p>Is an option that will be influenced by <code>gplaces_address_autocomplete</code> widget.<br>
This options should contains known <code>fields</code> that you want the widget to fulfill a value for each given field automatically.<br>
A field can contains one or multiple elements of component form<br>
By default this options are configured like the following
<code>javascript
{
'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></p>
<p>This configuration can be modify into view field definition as well<br>
Example:
<code>xml
<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></p>
<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>
<h1>New widget <code>"gplaces_autocomplete"</code></h1>
<p>New widget to integrate <a href="https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete">Place Autocomplete</a> in Odoo.
This widget have similar configuration to <code>gplaces_address_autocomplete</code>.</p>
<h3>Component form <code>component_form</code></h3>
<p>Same configuration of <code>gplaces_address_autocomplete</code> component form</p>
<h3>Fill fields <code>fillfields</code></h3>
<p>This configuration works similar to <code>gplaces_address_autocomplete</code>.
By default this options are configured like following value:
<code>javascript
{
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></p>
<h1>Technical</h1>
<p>This module will install <code>base_setup</code> and <code>base_geolocalize</code>.<br>
<em>I recommend you to setup <strong>Google Maps Key API</strong> and add it into Odoo <code>Settings > General</code> Settings when you installed this module</em></p>
<p><em><strong>List of Google APIs & services required in order to make all features works</strong></em>
- Geocoding API
- Maps JavaScript API
- Places API</p>
<p>Visit this <a href="https://developers.google.com/maps/documentation/javascript/get-api-key">page</a> of how to get Google API Key</p>
<p><a href="https://ko-fi.com/P5P4FOM0"><img src="https://www.ko-fi.com/img/donate_sm.png" alt="ko-fi"></a><br>
<em>if you want to support me to keep this project maintained. Thanks :)</em></p>