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
This commit is contained in:
Gavin D'souza 2022-03-03 19:38:34 +05:30
parent 0ef99c3886
commit 89a7dac300
2 changed files with 5 additions and 2 deletions

View file

@ -150,7 +150,8 @@ class Communication(Document, CommunicationEmailMixin):
self.content = f'{self.content}</p><br><p class="signature">{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

View file

@ -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: