diff --git a/erpnext/accounts/doctype/gl_entry/test_gl_entry.py b/erpnext/accounts/doctype/gl_entry/test_gl_entry.py
index f6ed163bff5..6ff378559c0 100644
--- a/erpnext/accounts/doctype/gl_entry/test_gl_entry.py
+++ b/erpnext/accounts/doctype/gl_entry/test_gl_entry.py
@@ -124,3 +124,20 @@ class TestGLEntry(unittest.TestCase):
str(e),
"Party Type and Party can only be set for Receivable / Payable account_Test Account Cost for Goods Sold - _TC",
)
+
+ def test_validate_account_party_type_shareholder(self):
+ jv = make_journal_entry(
+ "Opening Balance Equity - _TC",
+ "Cash - _TC",
+ 100,
+ "_Test Cost Center - _TC",
+ save=False,
+ submit=False,
+ )
+
+ for row in jv.accounts:
+ row.party_type = "Shareholder"
+ break
+
+ jv.save().submit()
+ self.assertEqual(1, jv.docstatus)
diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py
index 0df9dcb0683..f2e86ef2b2e 100644
--- a/erpnext/accounts/party.py
+++ b/erpnext/accounts/party.py
@@ -765,7 +765,7 @@ def validate_account_party_type(self):
if self.party_type and self.party:
account_type = frappe.get_cached_value("Account", self.account, "account_type")
- if account_type and (account_type not in ["Receivable", "Payable"]):
+ if account_type and (account_type not in ["Receivable", "Payable", "Equity"]):
frappe.throw(
_(
"Party Type and Party can only be set for Receivable / Payable account
" "{0}"