[FIX] base: runtime error in address_get if ids is empty

Closes #7359
This commit is contained in:
Antonio Espinosa 2015-06-30 08:24:47 +02:00 committed by Nicolas Martinelli
parent cee6ed33ac
commit c65fe46569
1 changed files with 3 additions and 1 deletions

View File

@ -743,6 +743,8 @@ class res_partner(osv.Model, format_address):
adr_pref.add('default')
result = {}
visited = set()
if isinstance(ids, (int, long)):
ids = [ids]
for partner in self.browse(cr, uid, filter(None, ids), context=context):
current_partner = partner
while current_partner:
@ -765,7 +767,7 @@ class res_partner(osv.Model, format_address):
current_partner = current_partner.parent_id
# default to type 'default' or the partner itself
default = result.get('default', partner.id)
default = result.get('default', ids and ids[0] or False)
for adr_type in adr_pref:
result[adr_type] = result.get(adr_type) or default
return result