Add communication entry to Sales Order only if payment entry email is sent to customer (#10716)
diff --git a/erpnext/accounts/doctype/payment_request/payment_request.py b/erpnext/accounts/doctype/payment_request/payment_request.py
index 44a3644..f3594b2 100644
--- a/erpnext/accounts/doctype/payment_request/payment_request.py
+++ b/erpnext/accounts/doctype/payment_request/payment_request.py
@@ -35,7 +35,6 @@
def on_submit(self):
send_mail = True
- self.make_communication_entry()
ref_doc = frappe.get_doc(self.reference_doctype, self.reference_name)
if (hasattr(ref_doc, "order_type") and getattr(ref_doc, "order_type") == "Shopping Cart") \
@@ -45,6 +44,7 @@
if send_mail:
self.set_payment_request_url()
self.send_email()
+ self.make_communication_entry()
def on_cancel(self):
self.check_if_payment_entry_exists()