mirror of
https://github.com/frappe/erpnext.git
synced 2026-10-29 22:57:42 +00:00
fix(accounts): require account types in chart imports
(cherry picked from commit 9c9b82f7bb)
This commit is contained in:
@@ -394,6 +394,18 @@ def validate_accounts(file_doc, extension):
|
||||
|
||||
validate_root(accounts_dict)
|
||||
|
||||
account_types = {account.get("account_type") for account in accounts}
|
||||
missing = [
|
||||
_(account["account_type"])
|
||||
for account in get_mandatory_account_types()
|
||||
if account["account_type"] not in account_types
|
||||
]
|
||||
if missing:
|
||||
frappe.throw(
|
||||
_("Please add accounts for the following Account Types: {0}").format(", ".join(missing)),
|
||||
title=_("Missing Account Types"),
|
||||
)
|
||||
|
||||
return [True, len(accounts)]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user