From fb511b1dfd1d9fd5a2acf6bb93d2b67c5b69a878 Mon Sep 17 00:00:00 2001 From: "Chinmay D. Pai" Date: Sun, 5 Jan 2020 00:28:55 +0530 Subject: [PATCH] fix(email): check if communication hasattr for attachment fixes issue where previous communication has no attribute _attachments before it fails, causing the following error: Traceback (most recent call last): File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/background_jobs.py", line 99, in execute_job method(**kwargs) File "/home/frappe/frappe-bench/apps/frappe/frappe/email/doctype/email_account/email_account.py", line 724, in pull_from_email_account email_account.receive() File "/home/frappe/frappe-bench/apps/frappe/frappe/email/doctype/email_account/email_account.py", line 295, in receive attachments = [d.file_name for d in communication._attachments] AttributeError: 'Communication' object has no attribute '_attachments' Signed-off-by: Chinmay D. Pai --- frappe/email/doctype/email_account/email_account.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/email/doctype/email_account/email_account.py b/frappe/email/doctype/email_account/email_account.py index 50daf1cf72..cc02cfa0ff 100755 --- a/frappe/email/doctype/email_account/email_account.py +++ b/frappe/email/doctype/email_account/email_account.py @@ -293,7 +293,7 @@ class EmailAccount(Document): else: frappe.db.commit() - if communication: + if communication and hasattr(communication, "_attachments"): attachments = [d.file_name for d in communication._attachments] communication.notify(attachments=attachments, fetched_from_email_account=True)