[ Enhance ] Setup Wizard - Chart of Accounts (#14698)

* enable selection of coa for user
Give user option to select coa that's been verified along with standard and standard with numbers. Also added a button that opens a dialog and renders the selected chart

* read chart from file and make a tree render-able dict of it

* tree method to return node data for coa setup wizard
This commit is contained in:
Zarrar
2018-06-28 14:15:34 +05:30
committed by Nabin Hait
parent c7897e491d
commit 254ce645b1
3 changed files with 106 additions and 8 deletions

View File

@@ -814,3 +814,19 @@ def get_doc_name_autoname(field_value, doc_title, name, company):
if cstr(field_value).strip():
parts.insert(0, cstr(field_value).strip())
return ' - '.join(parts)
@frappe.whitelist()
def get_coa(doctype, parent, is_root, chart=None):
from erpnext.accounts.doctype.account.chart_of_accounts.chart_of_accounts import build_tree_from_json
# add chart to flags to retrieve when called from expand all function
chart = chart if chart else frappe.flags.chart
frappe.flags.chart = chart
parent = None if parent==_('All Accounts') else parent
accounts = build_tree_from_json(chart) # returns alist of dict in a tree render-able form
# filter out to show data for the selected node only
accounts = [d for d in accounts if d['parent_account']==parent]
return accounts