Browse Source

Allow to skip entries in the _prepare method.

pull/22/head
Alexis de Lattre 11 years ago
parent
commit
54f92e9144
  1. 9
      base_location_geonames_import/wizard/geonames_import.py

9
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,13 +67,12 @@ 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)
bzip_id = self.pool['res.better.zip'].create(
cr, uid, vals, context=context)
if vals:
bzip_id = self.pool['res.better.zip'].create(
cr, uid, vals, context=context)
return bzip_id return bzip_id
def run_import(self, cr, uid, ids, context=None): def run_import(self, cr, uid, ids, context=None):

Loading…
Cancel
Save