Reverted gl entry splitting based on payment terms (#12117)

* Reverted gl entry splitting based on payment terms

* changed modified date
diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py
index 9c42f64..bd223b5 100644
--- a/erpnext/accounts/utils.py
+++ b/erpnext/accounts/utils.py
@@ -583,9 +583,10 @@
 		dr_or_cr = "credit_in_account_currency - debit_in_account_currency"
 		payment_dr_or_cr = "payment_gl_entry.debit_in_account_currency - payment_gl_entry.credit_in_account_currency"
 
+	invoice = 'Sales Invoice' if party_type == 'Customer' else 'Purchase Invoice'
 	invoice_list = frappe.db.sql("""
 		select
-			voucher_no,	voucher_type, posting_date, ifnull(sum({dr_or_cr}), 0) as invoice_amount, due_date,
+			voucher_no, voucher_type, posting_date, ifnull(sum({dr_or_cr}), 0) as invoice_amount,
 			(
 				select ifnull(sum({payment_dr_or_cr}), 0)
 				from `tabGL Entry` payment_gl_entry
@@ -596,7 +597,6 @@
 					and payment_gl_entry.party_type = invoice_gl_entry.party_type
 					and payment_gl_entry.party = invoice_gl_entry.party
 					and payment_gl_entry.account = invoice_gl_entry.account
-					and payment_gl_entry.due_date = invoice_gl_entry.due_date
 					and {payment_dr_or_cr} > 0
 			) as payment_amount
 		from
@@ -608,10 +608,11 @@
 			and ((voucher_type = 'Journal Entry'
 					and (against_voucher = '' or against_voucher is null))
 				or (voucher_type not in ('Journal Entry', 'Payment Entry')))
-		group by voucher_type, voucher_no, due_date
+		group by voucher_type, voucher_no
 		having (invoice_amount - payment_amount) > 0.005
 		order by posting_date, name, due_date""".format(
 			dr_or_cr=dr_or_cr,
+			invoice = invoice,
 			payment_dr_or_cr=payment_dr_or_cr,
 			condition=condition or ""
 		), {
@@ -621,12 +622,8 @@
 		}, as_dict=True)
 
 	for d in invoice_list:
-		due_date = d.due_date or (
-			frappe.db.get_value(
-				d.voucher_type, d.voucher_no,
-				"posting_date" if party_type == "Employee" else "due_date"
-			)
-		)
+		due_date = frappe.db.get_value(d.voucher_type, d.voucher_no,
+			"posting_date" if party_type == "Employee" else "due_date")
 
 		outstanding_invoices.append(
 			frappe._dict({