Created
May 31, 2023 14:07
-
-
Save ernestoruiz89/c5ddbedbad81f5def5dc9bdc2c21b79c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@frappe.whitelist() | |
def import_coa_job(file_name, company): | |
# delete existing data for accounts | |
unset_existing_data(company) | |
# create accounts | |
file_doc, extension = get_file(file_name) | |
if extension == "csv": | |
data = generate_data_from_csv(file_doc) | |
else: | |
data = generate_data_from_excel(file_doc, extension) | |
frappe.local.flags.ignore_root_company_validation = True | |
forest = build_forest(data) | |
create_charts(company, custom_chart=forest, from_coa_importer=True) | |
# trigger on_update for company to reset default accounts | |
set_default_accounts(company) | |
def import_coa(file_name, company): | |
frappe.enqueue(import_coa_job, queue="long", job_name="import_coa_job", file_name=file_name, company=company) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment