feat: Chart of Accounts Importer (#16623)

* bare doctype created for COA utility

* improvise doctype's design

* validation to check no transaction exist for the company

* download file and import coa - client side logic added

* download csv template to create custom chart

* read the custom csv uploaded and parse it to appropriate format

* convert list of list to nested tree structure

* preview the uploaded chart before actual import

* toggle field based on necessity

* tweak create_charts and build_json logic to incorporate COA Import utility

* code cleanify and validation call added

* code enhancement for flexibility and validation added

* show import button only if data is validated

* unset existing data and load new accounts

* disable coa fields if parent_company set, minor improv

* file api fix

* added progress bar

* codacy fixes

* fix: Add account number in template

* fix: TDS account exception handling fix
This commit is contained in:
Zarrar
2019-03-23 10:30:12 +05:30
committed by Deepesh Garg
parent 81f4d1c745
commit 963d62b701
10 changed files with 611 additions and 9 deletions

View File

@@ -276,4 +276,5 @@ var disbale_coa_fields = function(frm, bool=true) {
frm.set_df_property("create_chart_of_accounts_based_on", "read_only", bool);
frm.set_df_property("chart_of_accounts", "read_only", bool);
frm.set_df_property("existing_company", "read_only", bool);
};
}

View File

@@ -97,8 +97,6 @@ class Company(NestedSet):
install_country_fixtures(self.name)
self.create_default_tax_template()
if not frappe.db.get_value("Department", {"company": self.name}):
from erpnext.setup.setup_wizard.operations.install_fixtures import install_post_company_fixtures
install_post_company_fixtures(frappe._dict({'company_name': self.name}))
@@ -335,6 +333,11 @@ class Company(NestedSet):
where doctype='Global Defaults' and field='default_company'
and value=%s""", self.name)
# reset default company
frappe.db.sql("""update `tabSingles` set value=""
where doctype='Chart of Accounts Importer' and field='company'
and value=%s""", self.name)
# delete BOMs
boms = frappe.db.sql_list("select name from tabBOM where company=%s", self.name)
if boms: