From 99be941e7b3cbb4038904fcc3190a97a05a5e5c5 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 30 Oct 2014 15:48:22 +0530 Subject: [PATCH] Party is only relevant to receivable/payable account --- .../accounts/doctype/journal_voucher/journal_voucher.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/journal_voucher/journal_voucher.py b/erpnext/accounts/doctype/journal_voucher/journal_voucher.py index 4017de5786..67362ddfb4 100644 --- a/erpnext/accounts/doctype/journal_voucher/journal_voucher.py +++ b/erpnext/accounts/doctype/journal_voucher/journal_voucher.py @@ -66,9 +66,11 @@ class JournalVoucher(AccountsController): def validate_party(self): for d in self.get("entries"): account_type = frappe.db.get_value("Account", d.account, "account_type") - if account_type in ["Receivable", "Payable"] and not (d.party_type and d.party): - frappe.throw(_("Row{0}: Party Type and Party is required for Receivable / Payable account {1}").format(d.idx, d.account)) - + if account_type in ["Receivable", "Payable"]: + if not (d.party_type and d.party): + frappe.throw(_("Row{0}: Party Type and Party is required for Receivable / Payable account {1}").format(d.idx, d.account)) + elif d.party_type and d.party: + frappe.throw(_("Row{0}: Party Type and Party is only applicable against Receivable / Payable account {1}").format(d.idx, d.account)) def check_credit_limit(self): customers = list(set([d.party for d in self.get("entries") if d.party_type=="Customer"]))