Test if contact is set before reading it's language

issue10516
review352181002
This commit is contained in:
Sergi Almacellas Abellana
2021-06-29 11:59:30 +02:00
parent c24853041e
commit f3facedecf
+1 -1
View File
@@ -79,7 +79,7 @@ class EmailTemplate(metaclass=PoolMeta):
if isinstance(record, Party):
usage = Transaction().context.get('usage')
contact = record.contact_mechanism_get('email', usage=usage)
if contact.language:
if contact and contact.language:
language = contact.language
elif record.lang:
language = record.lang