mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 08:24:47 +00:00
Merge pull request #45687 from aerele/validate_equity_account
fix: add validation to allow equity account
This commit is contained in:
@@ -123,3 +123,20 @@ class TestGLEntry(IntegrationTestCase):
|
|||||||
str(e),
|
str(e),
|
||||||
"Party Type and Party can only be set for Receivable / Payable account_Test Account Cost for Goods Sold - _TC",
|
"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)
|
||||||
|
|||||||
@@ -777,7 +777,7 @@ def validate_account_party_type(self):
|
|||||||
|
|
||||||
if self.party_type and self.party:
|
if self.party_type and self.party:
|
||||||
account_type = frappe.get_cached_value("Account", self.account, "account_type")
|
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(
|
frappe.throw(
|
||||||
_(
|
_(
|
||||||
"Party Type and Party can only be set for Receivable / Payable account<br><br>" "{0}"
|
"Party Type and Party can only be set for Receivable / Payable account<br><br>" "{0}"
|
||||||
|
|||||||
Reference in New Issue
Block a user