diff --git a/base_location_geonames_import/README.rst b/base_location_geonames_import/README.rst index b5dd3e775..b06fe6cf0 100644 --- a/base_location_geonames_import/README.rst +++ b/base_location_geonames_import/README.rst @@ -6,21 +6,21 @@ Base Location Geonames Import ============================= -This module adds a wizard to import better zip entries from Geonames database. +This module adds a wizard to import better zip entries from `Geonames `_ database. Installation ============ -For installing this module, you need these Python libraries: requests and + +To install this module, you need these Python libraries: requests and unicodecsv. Configuration ============= -For seeing the menu, you need to activate *Technical features* option in your -user and to be *Sales manager*. +To access the menu to import better zip entries from Geonames, you must add yourself to the groups *Technical features* and *Sales manager*. If want want/need to modify the default URL -(http://download.geonames.org/export/zip/), you can set the 'geonames.url' +(http://download.geonames.org/export/zip/), you can set the *geonames.url* system parameter. Usage @@ -36,8 +36,7 @@ better zip entries. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/134/9.0 - + :target: https://runbot.odoo-community.org/runbot/134/10.0 Bug Tracker =========== @@ -45,11 +44,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 -`_. +help us smashing it by providing a detailed and welcomed feedback. Credits ======= @@ -63,16 +58,16 @@ Contributors Icon ---- + * http://icon-park.com/icon/location-map-pin-orange3/ * http://commons.wikimedia.org/wiki/File:View-refresh.svg - Maintainer ---------- -.. image:: http://odoo-community.org/logo.png +.. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association - :target: http://odoo-community.org + :target: https://odoo-community.org This module is maintained by the OCA. @@ -80,4 +75,4 @@ 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. -To contribute to this module, please visit http://odoo-community.org. +To contribute to this module, please visit https://odoo-community.org. diff --git a/base_location_geonames_import/__init__.py b/base_location_geonames_import/__init__.py index d18ad148c..3b4c3edf0 100644 --- a/base_location_geonames_import/__init__.py +++ b/base_location_geonames_import/__init__.py @@ -1,4 +1,3 @@ # -*- coding: utf-8 -*- -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import wizard diff --git a/base_location_geonames_import/__manifest__.py b/base_location_geonames_import/__manifest__.py index 415c08e06..ba69473e6 100644 --- a/base_location_geonames_import/__manifest__.py +++ b/base_location_geonames_import/__manifest__.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -# © 2014 Alexis de Lattre +# © 2014-2016 Akretion (Alexis de Lattre ) # © 2014 Lorenzo Battistini # © 2016 Pedro M. Baeza # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { 'name': 'Base Location Geonames Import', - 'version': '9.0.1.0.1', + 'version': '10.0.1.0.0', 'category': 'Partner Management', 'license': 'AGPL-3', 'summary': 'Import better zip entries from Geonames', @@ -21,5 +21,5 @@ 'data': [ 'wizard/geonames_import_view.xml', ], - 'installable': False, + 'installable': True, } diff --git a/base_location_geonames_import/tests/test_base_location_geonames_import.py b/base_location_geonames_import/tests/test_base_location_geonames_import.py index cf6455505..3015f5c15 100644 --- a/base_location_geonames_import/tests/test_base_location_geonames_import.py +++ b/base_location_geonames_import/tests/test_base_location_geonames_import.py @@ -2,7 +2,7 @@ # © 2016 Pedro M. Baeza # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from openerp.tests import common +from odoo.tests import common class TestBaseLocationGeonamesImport(common.TransactionCase): diff --git a/base_location_geonames_import/wizard/__init__.py b/base_location_geonames_import/wizard/__init__.py index 3c39c08d4..856fa2d2d 100644 --- a/base_location_geonames_import/wizard/__init__.py +++ b/base_location_geonames_import/wizard/__init__.py @@ -1,4 +1,3 @@ # -*- coding: utf-8 -*- -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import geonames_import diff --git a/base_location_geonames_import/wizard/geonames_import.py b/base_location_geonames_import/wizard/geonames_import.py index d0f1cc285..6eb2a922b 100644 --- a/base_location_geonames_import/wizard/geonames_import.py +++ b/base_location_geonames_import/wizard/geonames_import.py @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- -# © 2014 Alexis de Lattre +# © 2014-2016 Akretion (Alexis de Lattre ) # © 2014 Lorenzo Battistini # © 2016 Pedro M. Baeza # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from openerp import models, fields, api, _ -from openerp.exceptions import UserError +from odoo import models, fields, api, _ +from odoo.exceptions import UserError import requests import tempfile import StringIO @@ -27,10 +27,14 @@ class BetterZipGeonamesImport(models.TransientModel): _rec_name = 'country_id' country_id = fields.Many2one('res.country', 'Country', required=True) - title_case = fields.Boolean( - string='Title Case', - help='Converts retreived city and state names to Title Case.', - ) + letter_case = fields.Selection([ + ('unchanged', 'Unchanged'), + ('title', 'Title Case'), + ('upper', 'Upper Case'), + ], string='Letter Case', default='unchanged', + help="Converts retreived city and state names to Title Case " + "(upper case on each first letter of a word) or Upper Case " + "(all letters upper case).") @api.model def transform_city_name(self, city, country): @@ -66,9 +70,12 @@ class BetterZipGeonamesImport(models.TransientModel): "correspond to the selected country (%s).") % (row[0], country.code)) logger.debug('ZIP = %s - City = %s' % (row[1], row[2])) - if (self.title_case): + if self.letter_case.title: row[2] = row[2].title() row[3] = row[3].title() + elif self.letter_case.upper: + row[2] = row[2].upper() + row[3] = row[3].upper() if row[1] and row[2]: zip_model = self.env['res.better.zip'] zips = zip_model.search(self._domain_search_better_zip( diff --git a/base_location_geonames_import/wizard/geonames_import_view.xml b/base_location_geonames_import/wizard/geonames_import_view.xml index ea7a102a6..da6c21140 100644 --- a/base_location_geonames_import/wizard/geonames_import_view.xml +++ b/base_location_geonames_import/wizard/geonames_import_view.xml @@ -1,41 +1,39 @@ - - + - - asterisk.server.company - better.zip.geonames.import - -
- - - - - - -
-
-
-
-
+ + Import from Geonames form view + better.zip.geonames.import + +
+ +
+

For the selected country, this wizard will download the latest version of the list of cities from geonames.org, create new location entries if not found already in the system, and delete missing entries from new file.

+
+
+ + + + +
+
+
+
+
- - Import from Geonames - better.zip.geonames.import - form - form - new - + + Import from Geonames + better.zip.geonames.import + form + new + - + -
-
+