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 3015f5c15..82874ae74 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
@@ -21,7 +21,7 @@ class TestBaseLocationGeonamesImport(common.TransactionCase):
('country_id', '=', self.country.id)
])
self.assertTrue(state_count)
- # Look if the are imported zips
+ # Look if there are imported zips
zip_count = self.env['res.better.zip'].search_count([
('country_id', '=', self.country.id)
])
@@ -44,3 +44,19 @@ class TestBaseLocationGeonamesImport(common.TransactionCase):
})
self.wizard.run_import()
self.assertFalse(zip_entry.exists())
+
+ def test_import_title(self):
+ self.wizard.letter_case = 'title'
+ self.wizard.with_context(max_import=1).run_import()
+ zip = self.env['res.better.zip'].search(
+ [('country_id', '=', self.country.id)], limit=1
+ )
+ self.assertEqual(zip.city, zip.city.title())
+
+ def test_import_upper(self):
+ self.wizard.letter_case = 'upper'
+ self.wizard.with_context(max_import=1).run_import()
+ zip = self.env['res.better.zip'].search(
+ [('country_id', '=', self.country.id)], limit=1
+ )
+ self.assertEqual(zip.city, zip.city.upper())
diff --git a/base_location_geonames_import/wizard/geonames_import.py b/base_location_geonames_import/wizard/geonames_import.py
index 6eb2a922b..b31afd5af 100644
--- a/base_location_geonames_import/wizard/geonames_import.py
+++ b/base_location_geonames_import/wizard/geonames_import.py
@@ -70,10 +70,10 @@ 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.letter_case.title:
+ if self.letter_case == 'title':
row[2] = row[2].title()
row[3] = row[3].title()
- elif self.letter_case.upper:
+ elif self.letter_case == 'upper':
row[2] = row[2].upper()
row[3] = row[3].upper()
if row[1] and row[2]:
diff --git a/base_location_geonames_import/wizard/geonames_import_view.xml b/base_location_geonames_import/wizard/geonames_import_view.xml
index da6c21140..8aab10d1b 100644
--- a/base_location_geonames_import/wizard/geonames_import_view.xml
+++ b/base_location_geonames_import/wizard/geonames_import_view.xml
@@ -31,9 +31,11 @@
new
-
+