Fix contact_mechanism_get usage
The contact_mechanism_get returns a contact mechanism instance and not the value. Also the contact mechanism should be used as name if filled. issue7623 review49531002
This commit is contained in:
+4
-3
@@ -152,10 +152,11 @@ class Email(ModelSQL, ModelView):
|
||||
if isinstance(record, User) and record.email:
|
||||
return _formataddr(record.rec_name, record.email)
|
||||
elif Party and isinstance(record, Party):
|
||||
email = record.contact_mechanism_get(
|
||||
contact = record.contact_mechanism_get(
|
||||
'email', usage=self.contact_mechanism)
|
||||
if email:
|
||||
return _formataddr(record.rec_name, email)
|
||||
if contact and contact.email:
|
||||
return _formataddr(
|
||||
contact.name or record.rec_name, contact.email)
|
||||
elif WebUser and isinstance(record, WebUser):
|
||||
name = None
|
||||
if record.party:
|
||||
|
||||
Reference in New Issue
Block a user