From 89a7dac300deb85d3f6aa080c5460f79650a5b6b Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Thu, 3 Mar 2022 19:38:34 +0530 Subject: [PATCH] fix: Add signature only if not Communication.flags.skip_add_signature This is added to handle purposely removed signature or custom signatures added via the Email Composer or via the email.make API --- frappe/core/doctype/communication/communication.py | 3 ++- frappe/core/doctype/communication/email.py | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/frappe/core/doctype/communication/communication.py b/frappe/core/doctype/communication/communication.py index 759557ae4c..475762f39d 100644 --- a/frappe/core/doctype/communication/communication.py +++ b/frappe/core/doctype/communication/communication.py @@ -150,7 +150,8 @@ class Communication(Document, CommunicationEmailMixin): self.content = f'{self.content}


{signature}' def before_save(self): - self.set_signature_in_email_content() + if not self.flags.skip_add_signature: + self.set_signature_in_email_content() def on_update(self): # add to _comment property of the doctype, so it shows up in diff --git a/frappe/core/doctype/communication/email.py b/frappe/core/doctype/communication/email.py index 6a71697d37..195518f40d 100755 --- a/frappe/core/doctype/communication/email.py +++ b/frappe/core/doctype/communication/email.py @@ -147,7 +147,9 @@ def _make( "read_receipt":read_receipt, "has_attachment": 1 if attachments else 0, "communication_type": communication_type, - }).insert(ignore_permissions=True) + }) + comm.flags.skip_add_signature = True + comm.insert(ignore_permissions=True) # if not committed, delayed task doesn't find the communication if attachments: