From c3e1a8ff8676dd4ceb9c72d6c3abd2c0167e1464 Mon Sep 17 00:00:00 2001 From: Matthieu Dietrich Date: Wed, 4 Dec 2013 13:52:48 +0100 Subject: [PATCH] [FIX] more Pythonic method --- firstname_display_name_trigger/res_partner.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/firstname_display_name_trigger/res_partner.py b/firstname_display_name_trigger/res_partner.py index 547233913..a086bf784 100644 --- a/firstname_display_name_trigger/res_partner.py +++ b/firstname_display_name_trigger/res_partner.py @@ -37,10 +37,8 @@ class ResPartner(orm.Model): ids = [ids] res = [] for record in self.browse(cr, uid, ids, context=context): - name = '%s%s%s' % (record.lastname if record.lastname else u"", - u" " if record.firstname and record.lastname - else u"", - record.firstname if record.firstname else u"") + names = (record.lastname, record.firstname) + name = u" ".join([s for s in names if s]) if record.parent_id and not record.is_company: name = "%s, %s" % (record.parent_id.name, name) if context.get('show_address'):