[IMP] further improve reading of o2m commands, first read the record itself if an...
authorXavier Morel <xmo@openerp.com>
Mon, 10 Oct 2011 08:09:11 +0000 (10:09 +0200)
committerXavier Morel <xmo@openerp.com>
Mon, 10 Oct 2011 08:09:11 +0000 (10:09 +0200)
bzr revid: xmo@openerp.com-20111010080911-ykosbh8kp3tljyri

openerp/addons/base/res/res_bank.py

index 82d3717..826c1dd 100644 (file)
@@ -106,11 +106,15 @@ class res_partner_bank(osv.osv):
             value = ''
         if not context.get('address', False):
             return value
-        for _, id, address in context['address']:
+        for _, id, address_data 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]
+            address = {}
+            if id:
+                address.update(self.pool['res.partner.address']
+                    .read(cursor, user, [id], ['type', field], context=context)[0])
+            if address_data:
+                address.update(address_data)
+
             if address.get('type') == 'default':
                 return address.get(field, value)
             elif not address.get('type'):