[FIX] fix typos in (seldomly triggered) get_or_create_partner code

This commit is contained in:
Pieter J. Kersten
2012-05-03 12:38:51 +02:00
committed by Stefan Rijnhart
parent 179a122ae4
commit 7557c33125
2 changed files with 3 additions and 5 deletions

View File

@@ -46,9 +46,7 @@ class PostalCode(object):
'''
# Sort formats on length, longest first
formats = [(len(x), x) for x in format.split('|')]
formats.sort()
formats.reverse()
formats = [x[1] for x in formats]
formats = [x[1] for x in sorted(formats, lambda x,y: -cmp(x,y))]
self.res = [re.compile(x.replace('#', '\\d').replace('@','[A-Z]'))
for x in formats
]

View File

@@ -138,9 +138,9 @@ def get_or_create_partner(pool, cursor, uid, name, address, postal_code, city,
filter.append(('country_id', '=', country_id))
if address:
if len(address) >= 1:
filter.append(('street', 'ilike', addres[0]))
filter.append(('street', 'ilike', address[0]))
if len(address) > 1:
filter.append(('street2', 'ilike', addres[1]))
filter.append(('street2', 'ilike', address[1]))
if city:
filter.append(('city', 'ilike', city))
if postal_code: