mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 00:14:50 +00:00
[ 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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user