diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index a2882206b4a..f5fb49f0bba 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -1218,12 +1218,17 @@ class PaymentEntry(AccountsController): return "credit", reference.account if reference.reference_doctype == "Payment Entry": + # reference.account_type and reference.payment_type is only available for Reverse payments if reference.account_type == "Receivable" and reference.payment_type == "Pay": return "credit", self.party_account else: return "debit", self.party_account - return "debit", reference.account + if reference.reference_doctype == "Journal Entry": + if self.party_type == "Customer" and self.payment_type == "Receive": + return "credit", reference.account + else: + return "debit", reference.account def add_advance_gl_for_reference(self, gl_entries, invoice): args_dict = {