diff --git a/erpnext/accounts/doctype/gl_entry/gl_entry.py b/erpnext/accounts/doctype/gl_entry/gl_entry.py index 9418372c09..9223cdb3f0 100644 --- a/erpnext/accounts/doctype/gl_entry/gl_entry.py +++ b/erpnext/accounts/doctype/gl_entry/gl_entry.py @@ -44,9 +44,12 @@ class GLEntry(Document): frappe.throw(_("{0} is required").format(_(self.meta.get_label(k)))) account_type = frappe.db.get_value("Account", self.account, "account_type") - if account_type in ["Receivable", "Payable"] and not (self.party_type and self.party): - frappe.throw(_("Party Type and Party is required for Receivable / Payable account {0}").format(self.account)) - + if not (self.party_type and self.party): + if account_type == "Receivable": + frappe.throw(_("Customer is required against Receivable account {0}").format(self.account)) + elif account_type == "Payable": + frappe.throw(_("Supplier is required against Payable account {0}").format(self.account)) + # Zero value transaction is not allowed if not (flt(self.debit) or flt(self.credit)): frappe.throw(_("Either debit or credit amount is required for {0}").format(self.account))