[fix] Validate advance entry based on party
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py
index ec22483..a602956 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.py
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py
@@ -104,6 +104,12 @@
 						msgprint(_("Row {0}: Please check 'Is Advance' against Account {1} if this is an advance entry.").format(d.idx, d.account))
 					elif d.reference_type in ("Sales Order", "Purchase Order") and d.is_advance != "Yes":
 						frappe.throw(_("Row {0}: Payment against Sales/Purchase Order should always be marked as advance").format(d.idx))
+						
+				if d.is_advance == "Yes":
+					if d.party_type == 'Customer' and flt(d.debit) > 0:
+						frappe.throw(_("Row {0}: Advance against Customer must be credit").format(d.idx))
+					elif d.party_type == 'Supplier' and flt(d.credit) > 0:
+						frappe.throw(_("Row {0}: Advance against Supplier must be debit").format(d.idx))
 
 	def validate_against_jv(self):
 		for d in self.get('accounts'):