[IMP] res_partner : optimize name_get

This commit is contained in:
Tanguy Charlier
2015-09-25 17:11:49 +02:00
parent c078f71646
commit 93e9a4dce7
+2 -1
View File
@@ -581,11 +581,12 @@ class res_partner(osv.Model, format_address):
if isinstance(ids, (int, long)):
ids = [ids]
res = []
types_dict = dict(self.fields_get(cr, uid, context=context)['type']['selection'])
for record in self.browse(cr, uid, ids, context=context):
name = record.name or ''
if record.parent_id and not record.is_company:
if not name and record.type in ['invoice', 'delivery', 'other']:
name = dict(self.fields_get(cr, uid, context=context)['type']['selection'])[record.type]
name = types_dict[record.type]
name = "%s, %s" % (record.parent_name, name)
if context.get('show_address_only'):
name = self._display_address(cr, uid, record, without_company=True, context=context)