diff --git a/base_location_geonames_import/__manifest__.py b/base_location_geonames_import/__manifest__.py index 176523c03..51f3b26eb 100644 --- a/base_location_geonames_import/__manifest__.py +++ b/base_location_geonames_import/__manifest__.py @@ -8,7 +8,7 @@ { "name": "Base Location Geonames Import", - "version": "13.0.2.0.0", + "version": "14.0.1.0.0", "category": "Partner Management", "license": "AGPL-3", "summary": "Import zip entries from Geonames", @@ -22,6 +22,7 @@ "website": "https://github.com/OCA/partner-contact", "depends": ["base_location"], "data": [ + "security/ir.model.access.csv", "data/res_country_data.xml", "views/res_country_view.xml", "wizard/geonames_import_view.xml", diff --git a/base_location_geonames_import/models/res_country.py b/base_location_geonames_import/models/res_country.py index 538c4d9ec..d0ce4e9e6 100644 --- a/base_location_geonames_import/models/res_country.py +++ b/base_location_geonames_import/models/res_country.py @@ -4,7 +4,7 @@ from odoo import fields, models -class ResCountryState(models.Model): +class ResCountry(models.Model): _inherit = "res.country" diff --git a/base_location_geonames_import/readme/CONFIGURE.rst b/base_location_geonames_import/readme/CONFIGURE.rst index 71a216809..fef9f1b3e 100644 --- a/base_location_geonames_import/readme/CONFIGURE.rst +++ b/base_location_geonames_import/readme/CONFIGURE.rst @@ -1,7 +1,6 @@ To access the menu to import city zip entries from Geonames -you must add yourself to the groups *Administration / Settings* or, if you have sale module -installed, *Sales / Manager* group. +you must be part of the group *Administration / Settings*. -If you want/need to modify the default URL +If you want/need to modify the default Geonames URL (http://download.geonames.org/export/zip/), you can set the *geonames.url* system parameter. diff --git a/base_location_geonames_import/readme/INSTALL.rst b/base_location_geonames_import/readme/INSTALL.rst deleted file mode 100644 index a1de58de0..000000000 --- a/base_location_geonames_import/readme/INSTALL.rst +++ /dev/null @@ -1,3 +0,0 @@ -To install this module, you need the Python library 'requests':: - - pip install requests diff --git a/base_location_geonames_import/readme/USAGE.rst b/base_location_geonames_import/readme/USAGE.rst index c5c9d6bbb..058748355 100644 --- a/base_location_geonames_import/readme/USAGE.rst +++ b/base_location_geonames_import/readme/USAGE.rst @@ -1,8 +1,6 @@ -Go to *Contacts > Configuration > Localization > Import from Geonames*, -and click on it to open a wizard. +Go to the menu *Contacts > Configuration > Localization > Import from Geonames*. +In the wizard, select one or several countries and click on the *Import* button. -When you start the wizard, it will ask you to select a country. - -Then, for the selected country, it will delete all not detected entries, download +For each selected country, the wizard will delete all not detected entries, download the latest version of the list of cities from geonames.org and create new city zip entries. diff --git a/base_location_geonames_import/security/ir.model.access.csv b/base_location_geonames_import/security/ir.model.access.csv new file mode 100644 index 000000000..5d52c2f1b --- /dev/null +++ b/base_location_geonames_import/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_city_zip_geonames_import,Full access on city.zip.geonames.import to Settings group,model_city_zip_geonames_import,base.group_system,1,1,1,1 diff --git a/base_location_geonames_import/views/res_country_view.xml b/base_location_geonames_import/views/res_country_view.xml index 9be2162b5..56bbf9492 100644 --- a/base_location_geonames_import/views/res_country_view.xml +++ b/base_location_geonames_import/views/res_country_view.xml @@ -4,11 +4,10 @@ res.country.geonames.form res.country - form - - + + diff --git a/base_location_geonames_import/wizard/geonames_import.py b/base_location_geonames_import/wizard/geonames_import.py index 9811eae78..7cbbb1b7c 100644 --- a/base_location_geonames_import/wizard/geonames_import.py +++ b/base_location_geonames_import/wizard/geonames_import.py @@ -25,11 +25,8 @@ logger = logging.getLogger(__name__) class CityZipGeonamesImport(models.TransientModel): _name = "city.zip.geonames.import" _description = "Import City Zips from Geonames" - _rec_name = "country_id" country_ids = fields.Many2many("res.country", string="Countries") - # Remove field country_id in future versions - country_id = fields.Many2one("res.country", string="Country") letter_case = fields.Selection( [("unchanged", "Unchanged"), ("title", "Title Case"), ("upper", "Upper Case")], @@ -187,7 +184,7 @@ class CityZipGeonamesImport(models.TransientModel): return city_dict def run_import(self): - for country in self.country_ids or self.country_id: + for country in self.country_ids: parsed_csv = self.get_and_parse_csv(country) self._process_csv(parsed_csv, country) return True diff --git a/base_location_geonames_import/wizard/geonames_import_view.xml b/base_location_geonames_import/wizard/geonames_import_view.xml index 166180367..eea8556f1 100644 --- a/base_location_geonames_import/wizard/geonames_import_view.xml +++ b/base_location_geonames_import/wizard/geonames_import_view.xml @@ -27,7 +27,7 @@