Browse Source

[MIG] partner_external_map: Migration to 13.0

Co-authored-by: Ermanno Gnan <ermannognan@gmail.com>
Co-authored-by: Joao Marques <joao.marques@tecnativa.com>

TT19784
14.0
Ermanno Gnan 5 years ago
committed by Alexis de Lattre
parent
commit
1b362f9162
  1. 11
      partner_external_map/README.rst
  2. 4
      partner_external_map/__manifest__.py
  3. 2
      partner_external_map/data/map_website_data.xml
  4. 2
      partner_external_map/i18n/partner_external_map.pot
  5. 8
      partner_external_map/models/res_partner.py
  6. 1
      partner_external_map/readme/CONTRIBUTORS.rst
  7. 7
      partner_external_map/static/description/index.html
  8. 18
      partner_external_map/tests/test_partner_external_map.py

11
partner_external_map/README.rst

@ -14,13 +14,13 @@ Partner External Maps
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpartner--contact-lightgray.png?logo=github
:target: https://github.com/OCA/partner-contact/tree/12.0/partner_external_map
:target: https://github.com/OCA/partner-contact/tree/13.0/partner_external_map
:alt: OCA/partner-contact
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/partner-contact-12-0/partner-contact-12-0-partner_external_map
:target: https://translation.odoo-community.org/projects/partner-contact-13-0/partner-contact-13-0-partner_external_map
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/134/12.0
:target: https://runbot.odoo-community.org/runbot/134/13.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@ -88,7 +88,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/partner-contact/issues>`_.
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
`feedback <https://github.com/OCA/partner-contact/issues/new?body=module:%20partner_external_map%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/partner-contact/issues/new?body=module:%20partner_external_map%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
@ -112,6 +112,7 @@ Contributors
* Pedro M. Baeza
* Ernesto Tejeda
* João Marques
Maintainers
~~~~~~~~~~~
@ -126,6 +127,6 @@ 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.
This module is part of the `OCA/partner-contact <https://github.com/OCA/partner-contact/tree/12.0/partner_external_map>`_ project on GitHub.
This module is part of the `OCA/partner-contact <https://github.com/OCA/partner-contact/tree/13.0/partner_external_map>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

4
partner_external_map/__manifest__.py

@ -5,14 +5,14 @@
{
"name": "Partner External Maps",
"version": "12.0.1.0.1",
"version": "13.0.1.0.0",
"category": "Extra Tools",
"license": "AGPL-3",
"summary": "Add Map and Map Routing buttons on partner form to "
"open GMaps, OSM, Bing and others",
"author": "Akretion, " "Tecnativa, " "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/partner-contact",
"depends": ["base",],
"depends": ["base"],
"data": [
"views/res_partner_view.xml",
"views/map_website_view.xml",

2
partner_external_map/data/map_website_data.xml

@ -59,7 +59,7 @@
</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="address_url">https://www.mapquest.com/?q={ADDRESS}</field>
<field
name="lat_lon_url"
>https://www.mapquest.com/?center={LATITUDE},{LONGITUDE}</field>

2
partner_external_map/i18n/partner_external_map.pot

@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n"
"Language-Team: \n"

8
partner_external_map/models/res_partner.py

@ -14,7 +14,6 @@ logger = logging.getLogger(__name__)
class ResPartner(models.Model):
_inherit = "res.partner"
@api.multi
def _address_as_string(self):
self.ensure_one()
addr = []
@ -38,12 +37,14 @@ class ResPartner(models.Model):
for key, value in replace.items():
if not isinstance(value, str):
# for latitude and longitude which are floats
value = str(value)
if isinstance(value, float):
value = "%.5f" % value
else:
value = ""
url = url.replace(key, value)
logger.debug("Final URL: %s", url)
return url
@api.multi
def open_map(self):
self.ensure_one()
map_website = self.env.user.context_map_website_id
@ -82,7 +83,6 @@ class ResPartner(models.Model):
"target": "new",
}
@api.multi
def open_route_map(self):
self.ensure_one()
if not self.env.user.context_route_map_website_id:

1
partner_external_map/readme/CONTRIBUTORS.rst

@ -6,3 +6,4 @@
* Pedro M. Baeza
* Ernesto Tejeda
* João Marques

7
partner_external_map/static/description/index.html

@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/partner-contact/tree/12.0/partner_external_map"><img alt="OCA/partner-contact" src="https://img.shields.io/badge/github-OCA%2Fpartner--contact-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/partner-contact-12-0/partner-contact-12-0-partner_external_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/134/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<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/partner-contact/tree/13.0/partner_external_map"><img alt="OCA/partner-contact" src="https://img.shields.io/badge/github-OCA%2Fpartner--contact-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/partner-contact-13-0/partner-contact-13-0-partner_external_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/134/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>In the old days of Odoo/OpenERP, back in version 6.1, there was an official
<em>google_map</em> module ; this module added a <em>Map</em> button on the partner form view
and, when the user clicked on that button, it would open a new tab on its web
@ -437,7 +437,7 @@ or a route map.</p>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/partner-contact/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/partner-contact/issues/new?body=module:%20partner_external_map%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/partner-contact/issues/new?body=module:%20partner_external_map%0Aversion:%2013.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>
</div>
<div class="section" id="credits">
@ -459,6 +459,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
<li>Pedro M. Baeza</li>
<li>Ernesto Tejeda</li>
<li>João Marques</li>
</ul>
</li>
</ul>
@ -470,7 +471,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<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>This module is part of the <a class="reference external" href="https://github.com/OCA/partner-contact/tree/12.0/partner_external_map">OCA/partner-contact</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/partner-contact/tree/13.0/partner_external_map">OCA/partner-contact</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>
</div>
</div>

18
partner_external_map/tests/test_partner_external_map.py

@ -46,7 +46,7 @@ class TestPartnerExternalMap(common.TransactionCase):
self.assertEqual(self.user.partner_id, self.user.context_route_start_partner_id)
def test_open_map(self):
action = self.partner.sudo(self.user.id).open_map()
action = self.partner.with_user(self.user.id).open_map()
self.assertEqual(
action["url"],
"https://www.google.com/maps?ie=UTF8"
@ -54,7 +54,7 @@ class TestPartnerExternalMap(common.TransactionCase):
)
def test_open_route_map(self):
action = self.partner.sudo(self.user.id).open_route_map()
action = self.partner.with_user(self.user.id).open_route_map()
self.assertEqual(
action["url"],
"https://www.google.com/maps?saddr=Tomelloso"
@ -65,7 +65,7 @@ class TestPartnerExternalMap(common.TransactionCase):
def test_open_map_with_coordinates(self):
# Simulate that we have the base_geolocalize module installed creating
# by hand the variables - This can't be done with routes
partner = self.partner.sudo(self.user.id)
partner = self.partner.with_user(self.user.id)
partner.partner_latitude = 39.15837
partner.partner_longitude = -3.02145
action = partner.open_map()
@ -84,29 +84,29 @@ class TestPartnerExternalMap(common.TransactionCase):
}
)
with self.assertRaises(UserError):
self.partner.sudo(self.user.id).open_route_map()
self.partner.with_user(self.user.id).open_route_map()
def test_exception_no_map_website(self):
self.user.context_map_website_id = False
with self.assertRaises(UserError):
self.partner.sudo(self.user.id).open_map()
self.partner.with_user(self.user.id).open_map()
def test_exception_no_map_route_website(self):
self.user.context_route_start_partner_id = False
with self.assertRaises(UserError):
self.partner.sudo(self.user.id).open_route_map()
self.partner.with_user(self.user.id).open_route_map()
def test_exception_no_starting_partner(self):
self.user.context_route_map_website_id = False
with self.assertRaises(UserError):
self.partner.sudo(self.user.id).open_route_map()
self.partner.with_user(self.user.id).open_route_map()
def test_exception_no_address_url(self):
self.user.context_map_website_id.address_url = False
with self.assertRaises(UserError):
self.partner.sudo(self.user.id).open_map()
self.partner.with_user(self.user.id).open_map()
def test_exception_no_route_address_url(self):
self.user.context_map_website_id.route_address_url = False
with self.assertRaises(UserError):
self.partner.sudo(self.user.id).open_route_map()
self.partner.with_user(self.user.id).open_route_map()
Loading…
Cancel
Save