Browse Source

[FIX] base_location_geonames_import: Error on else code

Introducing second variable has provoked an error on that part.
12.0
Pedro M. Baeza 5 years ago
parent
commit
92f02f17bc
  1. 2
      base_location_geonames_import/__manifest__.py
  2. 9
      base_location_geonames_import/wizard/geonames_import.py

2
base_location_geonames_import/__manifest__.py

@ -8,7 +8,7 @@
{ {
'name': 'Base Location Geonames Import', 'name': 'Base Location Geonames Import',
'version': '12.0.1.0.2',
'version': '12.0.1.0.3',
'category': 'Partner Management', 'category': 'Partner Management',
'license': 'AGPL-3', 'license': 'AGPL-3',
'summary': 'Import zip entries from Geonames', 'summary': 'Import zip entries from Geonames',

9
base_location_geonames_import/wizard/geonames_import.py

@ -78,8 +78,8 @@ class CityZipGeonamesImport(models.TransientModel):
"SELECT id, name FROM res_city " "SELECT id, name FROM res_city "
"WHERE name = %s AND country_id = %s AND state_id = %s LIMIT 1", "WHERE name = %s AND country_id = %s AND state_id = %s LIMIT 1",
(self.transform_city_name(row[2], country), country.id, state_id)) (self.transform_city_name(row[2], country), country.id, state_id))
row = self.env.cr.fetchone()
return (row[0], row[1]) if row else (False, False)
row_city = self.env.cr.fetchone()
return (row_city[0], row_city[1]) if row_city else (False, False)
@api.model @api.model
def select_zip(self, row, country, state_id): def select_zip(self, row, country, state_id):
@ -169,8 +169,9 @@ class CityZipGeonamesImport(models.TransientModel):
if max_import and i == max_import: if max_import and i == max_import:
break break
state_id = state_dict[row[self.code_row_index or 4]] state_id = state_dict[row[self.code_row_index or 4]]
city_id, city_name = self.select_city(
row, self.country_id, state_id) if search_cities else False
city_id, city_name = (
self.select_city(row, self.country_id, state_id)
if search_cities else (False, False))
if not city_id: if not city_id:
city_vals = self.prepare_city( city_vals = self.prepare_city(
row, self.country_id, state_id) row, self.country_id, state_id)

Loading…
Cancel
Save