Test if contact is set before reading it's language

issue10516
review352181002
(grafted from b4aaf747da380f142c8ab2bd1fc686138280c229)

--HG--
branch : 6.0
This commit is contained in:
Sergi Almacellas Abellana committed 2021-06-29 11:59:30 +02:00
1 parent dc06deef10
commit b1ef005a5d
1 file changed
+1 -1
+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