summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Morel <xmo@openerp.com>2011-10-10 10:09:11 +0200
committerXavier Morel <xmo@openerp.com>2011-10-10 10:09:11 +0200
commit26140ce8f4e7db23ff65cb52f05ffda5b3a8d59a (patch)
tree4942831b2c93968c9eaf9e2bd12438070a82a8b7
parent9bd11f5031328c73f4a045521a0cb88ed74928f3 (diff)
[IMP] further improve reading of o2m commands, first read the record itself if an id was provided then update it with the record data if any
bzr revid: xmo@openerp.com-20111010080911-ykosbh8kp3tljyri
-rw-r--r--openerp/addons/base/res/res_bank.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/openerp/addons/base/res/res_bank.py b/openerp/addons/base/res/res_bank.py
index 82d3717aa8b..826c1dd4956 100644
--- a/openerp/addons/base/res/res_bank.py
+++ b/openerp/addons/base/res/res_bank.py
@@ -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'):