[IMP] if no address value is provided for res.partner.bank default_get context, try...
authorXavier Morel <xmo@openerp.com>
Fri, 7 Oct 2011 13:10:52 +0000 (15:10 +0200)
committerXavier Morel <xmo@openerp.com>
Fri, 7 Oct 2011 13:10:52 +0000 (15:10 +0200)
the web client currently does not send all record data when an o2m is used as a context value, it only sends the ids (at least when the o2m records have not been locally modified)

bzr revid: xmo@openerp.com-20111007131052-4qqo027b2mp16nd6

openerp/addons/base/res/res_bank.py

index 5a7c73c..82d3717 100644 (file)
@@ -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