Merge pull request #36994 from s-aga-r/19370
This commit is contained in:
commit
bb904fa60c
3 changed files with 9 additions and 4 deletions
|
|
@ -419,7 +419,7 @@ class Communication(Document, CommunicationEmailMixin):
|
|||
# Skip timeline links if a "Sent" communication already exists
|
||||
# else will create duplicate timeline entries
|
||||
if self.sent_or_received == "Received" and self.find_one_by_filters(
|
||||
message_id=self.message_id, sent_or_received="Sent"
|
||||
message_id=self.message_id, email_account=self.email_account, sent_or_received="Sent"
|
||||
):
|
||||
return
|
||||
|
||||
|
|
|
|||
|
|
@ -521,12 +521,14 @@ class TestInboundMail(IntegrationTestCase):
|
|||
|
||||
def test_mail_exist_validation(self):
|
||||
"""Do not create communication record if the mail is already downloaded into the system."""
|
||||
email_account = frappe.get_doc("Email Account", "_Test Email Account 1")
|
||||
mail_content = self.get_test_mail(fname="incoming-1.raw")
|
||||
message_id = Email(mail_content).message_id
|
||||
# Create new communication record in DB
|
||||
communication = self.new_communication(message_id=message_id, sent_or_received="Received")
|
||||
communication = self.new_communication(
|
||||
message_id=message_id, email_account=email_account.name, sent_or_received="Received"
|
||||
)
|
||||
|
||||
email_account = frappe.get_doc("Email Account", "_Test Email Account 1")
|
||||
inbound_mail = InboundMail(mail_content, email_account, 12345, 1)
|
||||
new_communication = inbound_mail.process()
|
||||
|
||||
|
|
|
|||
|
|
@ -751,7 +751,10 @@ class InboundMail(Email):
|
|||
return
|
||||
|
||||
return Communication.find_one_by_filters(
|
||||
message_id=self.message_id, sent_or_received="Received", order_by="creation DESC"
|
||||
message_id=self.message_id,
|
||||
email_account=self.email_account.name,
|
||||
sent_or_received="Received",
|
||||
order_by="creation DESC",
|
||||
)
|
||||
|
||||
def is_sender_same_as_receiver(self):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue