From 40580d5d01f2fb77b233cedd221d07a45fb75ef5 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 2 Dec 2013 16:20:18 +0530 Subject: [PATCH] [fix] [minor] Master name validation for customer/supplier/warehouse account --- accounts/doctype/account/account.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/accounts/doctype/account/account.py b/accounts/doctype/account/account.py index 992c4dc48b..cae202847b 100644 --- a/accounts/doctype/account/account.py +++ b/accounts/doctype/account/account.py @@ -38,9 +38,12 @@ class DocType: def validate_master_name(self): """Remind to add master name""" - if (self.doc.master_type == 'Customer' or self.doc.master_type == 'Supplier') \ - and not self.doc.master_name: - msgprint("Message: Please enter Master Name once the account is created.") + if self.doc.master_type in ('Customer', 'Supplier') or self.doc.account_type == "Warehouse": + if not self.doc.master_name: + msgprint(_("Please enter Master Name once the account is created.")) + elif not webnotes.conn.exists(self.doc.master_type or self.doc.account_type, + self.doc.master_name): + webnotes.throw(_("Invalid Master Name")) def validate_parent(self): """Fetch Parent Details and validation for account not to be created under ledger"""