[fix] [minor] Master name validation for customer/supplier/warehouse account
diff --git a/accounts/doctype/account/account.py b/accounts/doctype/account/account.py
index 992c4dc..cae2028 100644
--- a/accounts/doctype/account/account.py
+++ b/accounts/doctype/account/account.py
@@ -38,9 +38,12 @@
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"""