diff --git a/openerp/addons/base/res/res_bank.py b/openerp/addons/base/res/res_bank.py index 5a7c73c7f6d..82d3717aa8b 100644 --- a/openerp/addons/base/res/res_bank.py +++ b/openerp/addons/base/res/res_bank.py @@ -106,10 +106,14 @@ class res_partner_bank(osv.osv): value = '' if not context.get('address', False): return value - for ham, spam, address in context['address']: - if address.get('type', False) == 'default': + for _, id, address in context['address']: + if not (id or address): continue + if not address: + address = self.pool['res.partner.address']\ + .read(cursor, user, [id], ['type', field], context=context)[0] + if address.get('type') == 'default': return address.get(field, value) - elif not address.get('type', False): + elif not address.get('type'): value = address.get(field, value) return value