From 1b362f91625c0439d327f6e797490feb688b84c0 Mon Sep 17 00:00:00 2001 From: Ermanno Gnan Date: Sun, 24 Nov 2019 15:50:23 +0100 Subject: [PATCH] [MIG] partner_external_map: Migration to 13.0 Co-authored-by: Ermanno Gnan Co-authored-by: Joao Marques TT19784 --- partner_external_map/README.rst | 11 ++++++----- partner_external_map/__manifest__.py | 4 ++-- partner_external_map/data/map_website_data.xml | 2 +- .../i18n/partner_external_map.pot | 2 +- partner_external_map/models/res_partner.py | 8 ++++---- partner_external_map/readme/CONTRIBUTORS.rst | 1 + .../static/description/index.html | 7 ++++--- .../tests/test_partner_external_map.py | 18 +++++++++--------- 8 files changed, 28 insertions(+), 25 deletions(-) diff --git a/partner_external_map/README.rst b/partner_external_map/README.rst index 25173f099..a5f586bc6 100644 --- a/partner_external_map/README.rst +++ b/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 `_. 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 `_. +`feedback `_. 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 `_ project on GitHub. +This module is part of the `OCA/partner-contact `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/partner_external_map/__manifest__.py b/partner_external_map/__manifest__.py index 19f1d497b..317fc7d80 100644 --- a/partner_external_map/__manifest__.py +++ b/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", diff --git a/partner_external_map/data/map_website_data.xml b/partner_external_map/data/map_website_data.xml index 85cd789a8..9a9cb0062 100644 --- a/partner_external_map/data/map_website_data.xml +++ b/partner_external_map/data/map_website_data.xml @@ -59,7 +59,7 @@ MapQuest - https://www.mapquest.com/?center={ADDRESS} + https://www.mapquest.com/?q={ADDRESS} https://www.mapquest.com/?center={LATITUDE},{LONGITUDE} diff --git a/partner_external_map/i18n/partner_external_map.pot b/partner_external_map/i18n/partner_external_map.pot index e59aa7a28..3c35e9050 100644 --- a/partner_external_map/i18n/partner_external_map.pot +++ b/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" diff --git a/partner_external_map/models/res_partner.py b/partner_external_map/models/res_partner.py index 913a26232..ec2b3bb3f 100644 --- a/partner_external_map/models/res_partner.py +++ b/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: diff --git a/partner_external_map/readme/CONTRIBUTORS.rst b/partner_external_map/readme/CONTRIBUTORS.rst index 5e7de1710..2c1df0ab4 100644 --- a/partner_external_map/readme/CONTRIBUTORS.rst +++ b/partner_external_map/readme/CONTRIBUTORS.rst @@ -6,3 +6,4 @@ * Pedro M. Baeza * Ernesto Tejeda + * João Marques diff --git a/partner_external_map/static/description/index.html b/partner_external_map/static/description/index.html index 2d35818bf..c1aabe9af 100644 --- a/partner_external_map/static/description/index.html +++ b/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. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/partner-contact Translate me on Weblate Try me on Runbot

+

Beta License: AGPL-3 OCA/partner-contact Translate me on Weblate Try me on Runbot

In the old days of Odoo/OpenERP, back in version 6.1, there was an official google_map module ; this module added a Map 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.

Bugs are tracked on GitHub 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.

+feedback.

Do not contact contributors directly about support or help with technical issues.

@@ -459,6 +459,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
  • Tecnativa:
    • Pedro M. Baeza
    • Ernesto Tejeda
    • +
    • João Marques
  • @@ -470,7 +471,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome

    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 project on GitHub.

    +

    This module is part of the OCA/partner-contact project on GitHub.

    You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

    diff --git a/partner_external_map/tests/test_partner_external_map.py b/partner_external_map/tests/test_partner_external_map.py index 43bf00e3a..5c694a56b 100644 --- a/partner_external_map/tests/test_partner_external_map.py +++ b/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()