From 0a99b4347bef3148e8797500ab1bb9baab1e1827 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 26 Aug 2016 12:30:37 +0530 Subject: [PATCH] Party mandatory message --- erpnext/accounts/doctype/gl_entry/gl_entry.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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))