def get_coa(doctype, parent, is_root=False, file_name=None, for_validate=0): """called by tree view (to fetch node's children)""" file_doc, extension = get_file(file_name) parent = None if parent == _("All Accounts") else parent if extension == "csv": data = generate_data_from_csv(file_doc) else: data = generate_data_from_excel(file_doc, extension) validate_columns(data) validate_accounts(file_doc, extension) if not for_validate: forest = build_forest(data) accounts = build_tree_from_json( "", chart_data=forest, from_coa_importer=True ) # returns a list 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 else: return {"show_import_button": 1}
def get_coa(doctype, parent, is_root=False, file_name=None): ''' called by tree view (to fetch node's children) ''' parent = None if parent==_('All Accounts') else parent forest = build_forest(generate_data_from_csv(file_name)) accounts = build_tree_from_json("", chart_data=forest) # 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
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
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