João Marques
4 years ago
committed by
Alexis de Lattre
13 changed files with 371 additions and 290 deletions
-
1partner_external_map/__init__.py
-
38partner_external_map/__manifest__.py
-
119partner_external_map/data/map_website_data.xml
-
27partner_external_map/hooks.py
-
1partner_external_map/models/__init__.py
-
28partner_external_map/models/map_website.py
-
114partner_external_map/models/res_partner.py
-
48partner_external_map/models/res_users.py
-
1partner_external_map/tests/__init__.py
-
88partner_external_map/tests/test_partner_external_map.py
-
85partner_external_map/views/map_website_view.xml
-
49partner_external_map/views/res_partner_view.xml
-
62partner_external_map/views/res_users_view.xml
@ -1,3 +1,2 @@ |
|||
|
|||
from . import models |
|||
from .hooks import set_default_map_settings |
@ -1,55 +1,76 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<?xml version="1.0" encoding="utf-8" ?> |
|||
<!-- Copyright 2015-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>) |
|||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl-3). --> |
|||
|
|||
<odoo> |
|||
|
|||
<!-- Interesting source of information: http://northwestspatial.com/wp/?p=38 --> |
|||
<record id="google_maps" model="map.website"> |
|||
<field name="name">Google Maps</field> |
|||
<field name="address_url">https://www.google.com/maps?ie=UTF8&q={ADDRESS}</field> |
|||
<field name="lat_lon_url">https://www.google.com/maps?z=15&q={LATITUDE},{LONGITUDE}</field> |
|||
<field name="route_address_url">https://www.google.com/maps?saddr={START_ADDRESS}&daddr={DEST_ADDRESS}&directionsmode=driving</field> |
|||
<field name="route_lat_lon_url">https://www.google.com/maps?saddr={START_LATITUDE},{START_LONGITUDE}&daddr={DEST_LATITUDE},{DEST_LONGITUDE}&directionsmode=driving</field> |
|||
</record> |
|||
|
|||
<record id="openstreetmap" model="map.website"> |
|||
<field name="name">OpenStreetMap</field> |
|||
<field name="address_url">https://nominatim.openstreetmap.org/search?q={ADDRESS}</field> |
|||
<field name="lat_lon_url">https://www.openstreetmap.org/?zoom=15&mlat={LATITUDE}&mlon={LONGITUDE}</field> |
|||
<field name="route_lat_lon_url">https://www.openstreetmap.org/directions/?engine=orsm_car&route={START_LATITUDE},{START_LONGITUDE};{DEST_LATITUDE},{DEST_LONGITUDE}</field> |
|||
</record> |
|||
|
|||
<record id="openstreetmap_fr" model="map.website"> |
|||
<field name="name">OpenStreetMap FR</field> |
|||
<field name="address_url">http://tile.openstreetmap.fr/?q={ADDRESS}</field> |
|||
<field name="lat_lon_url">http://tile.openstreetmap.fr/?zoom=15&lat={LATITUDE}&lon={LONGITUDE}</field> |
|||
</record> |
|||
|
|||
<record id="bing_maps" model="map.website"> |
|||
<field name="name">Bing Maps</field> |
|||
<field name="address_url">https://www.bing.com/maps/default.aspx?where1={ADDRESS}</field> |
|||
<field name="lat_lon_url">https://www.bing.com/maps/default.aspx?where1={LATITUDE},{LONGITUDE}&lvl=15</field> |
|||
</record> |
|||
|
|||
<record id="here" model="map.website"> |
|||
<field name="name">Here Maps</field> |
|||
<field name="address_url">https://here.com/search/{ADDRESS}</field> |
|||
<field name="lat_lon_url">https://www.here.com/?map={LATITUDE},{LONGITUDE},15,normal</field> |
|||
<!-- TODO : for here maps, try to find a lat_lon_url with dot --> |
|||
<field name="route_lat_lon_url">https://www.here.com/directions/drive/:{START_LATITUDE},{START_LONGITUDE}/:{DEST_LATITUDE},{DEST_LONGITUDE}</field> |
|||
</record> |
|||
|
|||
<record id="mapquest" model="map.website"> |
|||
<field name="name">MapQuest</field> |
|||
<field name="address_url">https://www.mapquest.com/?center={ADDRESS}</field> |
|||
<field name="lat_lon_url">https://www.mapquest.com/?center={LATITUDE},{LONGITUDE}</field> |
|||
<field name="route_address_url">https://www.mapquest.com/directions?q1={START_ADDRESS}&q2={DEST_ADDRESS}</field> |
|||
<field name="route_lat_lon_url">https://www.mapquest.com/directions/from/near-{START_LATITUDE},{START_LONGITUDE}/to/near-{DEST_LATITUDE},{DEST_LONGITUDE}</field> |
|||
</record> |
|||
|
|||
<!-- On June 4, 2015, Yahoo! announced that Yahoo! Maps would be shut down |
|||
<!-- Interesting source of information: http://northwestspatial.com/wp/?p=38 --> |
|||
<record id="google_maps" model="map.website"> |
|||
<field name="name">Google Maps</field> |
|||
<field |
|||
name="address_url" |
|||
>https://www.google.com/maps?ie=UTF8&q={ADDRESS}</field> |
|||
<field |
|||
name="lat_lon_url" |
|||
>https://www.google.com/maps?z=15&q={LATITUDE},{LONGITUDE}</field> |
|||
<field |
|||
name="route_address_url" |
|||
>https://www.google.com/maps?saddr={START_ADDRESS}&daddr={DEST_ADDRESS}&directionsmode=driving</field> |
|||
<field |
|||
name="route_lat_lon_url" |
|||
>https://www.google.com/maps?saddr={START_LATITUDE},{START_LONGITUDE}&daddr={DEST_LATITUDE},{DEST_LONGITUDE}&directionsmode=driving</field> |
|||
</record> |
|||
<record id="openstreetmap" model="map.website"> |
|||
<field name="name">OpenStreetMap</field> |
|||
<field |
|||
name="address_url" |
|||
>https://nominatim.openstreetmap.org/search?q={ADDRESS}</field> |
|||
<field |
|||
name="lat_lon_url" |
|||
>https://www.openstreetmap.org/?zoom=15&mlat={LATITUDE}&mlon={LONGITUDE}</field> |
|||
<field |
|||
name="route_lat_lon_url" |
|||
>https://www.openstreetmap.org/directions/?engine=orsm_car&route={START_LATITUDE},{START_LONGITUDE};{DEST_LATITUDE},{DEST_LONGITUDE}</field> |
|||
</record> |
|||
<record id="openstreetmap_fr" model="map.website"> |
|||
<field name="name">OpenStreetMap FR</field> |
|||
<field name="address_url">http://tile.openstreetmap.fr/?q={ADDRESS}</field> |
|||
<field |
|||
name="lat_lon_url" |
|||
>http://tile.openstreetmap.fr/?zoom=15&lat={LATITUDE}&lon={LONGITUDE}</field> |
|||
</record> |
|||
<record id="bing_maps" model="map.website"> |
|||
<field name="name">Bing Maps</field> |
|||
<field |
|||
name="address_url" |
|||
>https://www.bing.com/maps/default.aspx?where1={ADDRESS}</field> |
|||
<field |
|||
name="lat_lon_url" |
|||
>https://www.bing.com/maps/default.aspx?where1={LATITUDE},{LONGITUDE}&lvl=15</field> |
|||
</record> |
|||
<record id="here" model="map.website"> |
|||
<field name="name">Here Maps</field> |
|||
<field name="address_url">https://here.com/search/{ADDRESS}</field> |
|||
<field |
|||
name="lat_lon_url" |
|||
>https://www.here.com/?map={LATITUDE},{LONGITUDE},15,normal</field> |
|||
<!-- TODO : for here maps, try to find a lat_lon_url with dot --> |
|||
<field |
|||
name="route_lat_lon_url" |
|||
>https://www.here.com/directions/drive/:{START_LATITUDE},{START_LONGITUDE}/:{DEST_LATITUDE},{DEST_LONGITUDE}</field> |
|||
</record> |
|||
<record id="mapquest" model="map.website"> |
|||
<field name="name">MapQuest</field> |
|||
<field name="address_url">https://www.mapquest.com/?center={ADDRESS}</field> |
|||
<field |
|||
name="lat_lon_url" |
|||
>https://www.mapquest.com/?center={LATITUDE},{LONGITUDE}</field> |
|||
<field |
|||
name="route_address_url" |
|||
>https://www.mapquest.com/directions?q1={START_ADDRESS}&q2={DEST_ADDRESS}</field> |
|||
<field |
|||
name="route_lat_lon_url" |
|||
>https://www.mapquest.com/directions/from/near-{START_LATITUDE},{START_LONGITUDE}/to/near-{DEST_LATITUDE},{DEST_LONGITUDE}</field> |
|||
</record> |
|||
<!-- On June 4, 2015, Yahoo! announced that Yahoo! Maps would be shut down |
|||
https://www.cnet.com/news/yahoo-to-shut-down-its-maps-site/ |
|||
--> |
|||
|
|||
</odoo> |
@ -1,4 +1,3 @@ |
|||
|
|||
from . import map_website |
|||
from . import res_partner |
|||
from . import res_users |
@ -1,2 +1 @@ |
|||
|
|||
from . import test_partner_external_map |
@ -1,51 +1,52 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<?xml version="1.0" encoding="utf-8" ?> |
|||
<!-- |
|||
Copyright 2015-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>) |
|||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
--> |
|||
|
|||
<odoo> |
|||
|
|||
<record id="map_website_form" model="ir.ui.view"> |
|||
<field name="name">map.website.form</field> |
|||
<field name="model">map.website</field> |
|||
<field name="arch" type="xml"> |
|||
<form string="Map Website"> |
|||
<group name="main"> |
|||
<field name="name"/> |
|||
<field name="address_url"/> |
|||
<field name="lat_lon_url"/> |
|||
<field name="route_address_url"/> |
|||
<field name="route_lat_lon_url"/> |
|||
</group> |
|||
</form> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="map_website_tree" model="ir.ui.view"> |
|||
<field name="name">map.website.tree</field> |
|||
<field name="model">map.website</field> |
|||
<field name="arch" type="xml"> |
|||
<tree string="Map Websites"> |
|||
<field name="name"/> |
|||
<field name="address_url"/> |
|||
</tree> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="map_website_action" model="ir.actions.act_window"> |
|||
<field name="name">Map Websites</field> |
|||
<field name="res_model">map.website</field> |
|||
<field name="view_mode">tree,form</field> |
|||
</record> |
|||
|
|||
<!-- Menu entry under Settings > Technical |
|||
<record id="map_website_form" model="ir.ui.view"> |
|||
<field name="name">map.website.form</field> |
|||
<field name="model">map.website</field> |
|||
<field name="arch" type="xml"> |
|||
<form string="Map Website"> |
|||
<group name="main"> |
|||
<field name="name" /> |
|||
<field name="address_url" /> |
|||
<field name="lat_lon_url" /> |
|||
<field name="route_address_url" /> |
|||
<field name="route_lat_lon_url" /> |
|||
</group> |
|||
</form> |
|||
</field> |
|||
</record> |
|||
<record id="map_website_tree" model="ir.ui.view"> |
|||
<field name="name">map.website.tree</field> |
|||
<field name="model">map.website</field> |
|||
<field name="arch" type="xml"> |
|||
<tree string="Map Websites"> |
|||
<field name="name" /> |
|||
<field name="address_url" /> |
|||
</tree> |
|||
</field> |
|||
</record> |
|||
<record id="map_website_action" model="ir.actions.act_window"> |
|||
<field name="name">Map Websites</field> |
|||
<field name="res_model">map.website</field> |
|||
<field name="view_mode">tree,form</field> |
|||
</record> |
|||
<!-- Menu entry under Settings > Technical |
|||
We prefered the menu entry of previous Odoo versions under |
|||
Sales > Config > Address Book > Localization, but in v10 that |
|||
would required a dependency on sales_team, and we don't want that --> |
|||
<menuitem id="root_map_website_menu" name="Map Websites" parent="base.menu_custom" sequence="100"/> |
|||
|
|||
<menuitem id="map_website_menu" action="map_website_action" |
|||
parent="root_map_website_menu"/> |
|||
|
|||
<menuitem |
|||
id="root_map_website_menu" |
|||
name="Map Websites" |
|||
parent="base.menu_custom" |
|||
sequence="100" |
|||
/> |
|||
<menuitem |
|||
id="map_website_menu" |
|||
action="map_website_action" |
|||
parent="root_map_website_menu" |
|||
/> |
|||
</odoo> |
@ -1,28 +1,33 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<?xml version="1.0" encoding="utf-8" ?> |
|||
<!-- |
|||
Copyright 2015-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>) |
|||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
--> |
|||
|
|||
<odoo> |
|||
|
|||
<!-- Inherit partner view to add 'Map' and 'Route Map' buttons --> |
|||
<record id="view_partner_form" model="ir.ui.view"> |
|||
<field name="name">map.button.res.partner.form</field> |
|||
<field name="model">res.partner</field> |
|||
<field name="inherit_id" ref="base.view_partner_form"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//div[@name='button_box']" position="inside"> |
|||
<button class="oe_inline oe_stat_button" |
|||
name="open_map" type="object" string="Map" |
|||
attrs="{'invisible': [('city', '=', False)]}" |
|||
icon="fa-map-marker"/> |
|||
<button class="oe_inline oe_stat_button" |
|||
name="open_route_map" type="object" string="Route Map" |
|||
attrs="{'invisible': [('city', '=', False)]}" |
|||
icon="fa-car"/> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
|
|||
<!-- Inherit partner view to add 'Map' and 'Route Map' buttons --> |
|||
<record id="view_partner_form" model="ir.ui.view"> |
|||
<field name="name">map.button.res.partner.form</field> |
|||
<field name="model">res.partner</field> |
|||
<field name="inherit_id" ref="base.view_partner_form" /> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//div[@name='button_box']" position="inside"> |
|||
<button |
|||
class="oe_inline oe_stat_button" |
|||
name="open_map" |
|||
type="object" |
|||
string="Map" |
|||
attrs="{'invisible': [('city', '=', False)]}" |
|||
icon="fa-map-marker" |
|||
/> |
|||
<button |
|||
class="oe_inline oe_stat_button" |
|||
name="open_route_map" |
|||
type="object" |
|||
string="Route Map" |
|||
attrs="{'invisible': [('city', '=', False)]}" |
|||
icon="fa-car" |
|||
/> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
</odoo> |
@ -1,39 +1,37 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<?xml version="1.0" encoding="utf-8" ?> |
|||
<!-- |
|||
Copyright 2015-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>) |
|||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
--> |
|||
|
|||
<odoo> |
|||
|
|||
<record id="view_users_form" model="ir.ui.view"> |
|||
<field name="name">map.res.users.form</field> |
|||
<field name="model">res.users</field> |
|||
<field name="inherit_id" ref="base.view_users_form"/> |
|||
<field name="arch" type="xml"> |
|||
<group name="messaging" position="after"> |
|||
<group name="maps" string="Maps"> |
|||
<field name="context_map_website_id" widget="selection"/> |
|||
<field name="context_route_map_website_id" widget="selection"/> |
|||
<field name="context_route_start_partner_id"/> |
|||
<record id="view_users_form" model="ir.ui.view"> |
|||
<field name="name">map.res.users.form</field> |
|||
<field name="model">res.users</field> |
|||
<field name="inherit_id" ref="base.view_users_form" /> |
|||
<field name="arch" type="xml"> |
|||
<group name="messaging" position="after"> |
|||
<group name="maps" string="Maps"> |
|||
<field name="context_map_website_id" widget="selection" /> |
|||
<field name="context_route_map_website_id" widget="selection" /> |
|||
<field name="context_route_start_partner_id" /> |
|||
</group> |
|||
</group> |
|||
</group> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="view_users_form_simple_modif" model="ir.ui.view"> |
|||
<field name="name">map.preferences.res.users.form</field> |
|||
<field name="model">res.users</field> |
|||
<field name="inherit_id" ref="base.view_users_form_simple_modif"/> |
|||
<field name="arch" type="xml"> |
|||
<group name="preferences" position="inside"> |
|||
<field name="context_map_website_id" |
|||
readonly="0" widget="selection"/> |
|||
<field name="context_route_map_website_id" |
|||
readonly="0" widget="selection"/> |
|||
<field name="context_route_start_partner_id" readonly="0"/> |
|||
</group> |
|||
</field> |
|||
</record> |
|||
|
|||
</field> |
|||
</record> |
|||
<record id="view_users_form_simple_modif" model="ir.ui.view"> |
|||
<field name="name">map.preferences.res.users.form</field> |
|||
<field name="model">res.users</field> |
|||
<field name="inherit_id" ref="base.view_users_form_simple_modif" /> |
|||
<field name="arch" type="xml"> |
|||
<group name="preferences" position="inside"> |
|||
<field name="context_map_website_id" readonly="0" widget="selection" /> |
|||
<field |
|||
name="context_route_map_website_id" |
|||
readonly="0" |
|||
widget="selection" |
|||
/> |
|||
<field name="context_route_start_partner_id" readonly="0" /> |
|||
</group> |
|||
</field> |
|||
</record> |
|||
</odoo> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue