Browse Source

Allow to skip entries in the _prepare method.

pull/22/head
Alexis de Lattre 11 years ago
committed by Lorenzo Battistini
parent
commit
c50948770f
  1. 5
      base_location_geonames_import/wizard/geonames_import.py

5
base_location_geonames_import/wizard/geonames_import.py

@ -47,6 +47,8 @@ class better_zip_geonames_import(orm.TransientModel):
state_id = False state_id = False
if states and row[4] and row[4] in states: if states and row[4] and row[4] in states:
state_id = states[row[4].upper()] state_id = states[row[4].upper()]
if row[0] == 'FR' and 'CEDEX' in row[1]:
return False
vals = { vals = {
'name': row[1], 'name': row[1],
'city': row[2], 'city': row[2],
@ -65,11 +67,10 @@ class better_zip_geonames_import(orm.TransientModel):
_("The content of the file doesn't correspond to the " _("The content of the file doesn't correspond to the "
"selected country.")) "selected country."))
logger.debug('ZIP = %s - City = %s' % (row[1], row[2])) logger.debug('ZIP = %s - City = %s' % (row[1], row[2]))
if row[0] == 'FR' and 'CEDEX' in row[1]:
return False
if row[1] and row[2]: if row[1] and row[2]:
vals = self._prepare_better_zip( vals = self._prepare_better_zip(
cr, uid, row, country_id, states, context=context) cr, uid, row, country_id, states, context=context)
if vals:
bzip_id = self.pool['res.better.zip'].create( bzip_id = self.pool['res.better.zip'].create(
cr, uid, vals, context=context) cr, uid, vals, context=context)
return bzip_id return bzip_id

Loading…
Cancel
Save