From 563903526818b6b1fd3cd4d01c4607e0fc21b38f Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 9 Apr 2013 14:56:30 +0530 Subject: [PATCH] [patch] create chart of accounts if not created --- patches/april_2013/p05_create_chart_of_accounts.py | 7 ------- patches/march_2013/p08_create_aii_accounts.py | 8 +++++++- patches/patch_list.py | 1 - 3 files changed, 7 insertions(+), 9 deletions(-) delete mode 100644 patches/april_2013/p05_create_chart_of_accounts.py diff --git a/patches/april_2013/p05_create_chart_of_accounts.py b/patches/april_2013/p05_create_chart_of_accounts.py deleted file mode 100644 index 3a38a2c863..0000000000 --- a/patches/april_2013/p05_create_chart_of_accounts.py +++ /dev/null @@ -1,7 +0,0 @@ -import webnotes -def execute(): - for company in webnotes.conn.sql("select name from `tabCompany`"): - if not webnotes.conn.sql("select * from `tabAccount` where company = %s", company[0]): - webnotes.conn.sql("""update `tabCompany` set receivables_group = '', - payables_group = '' where name = %s""", company[0]) - webnotes.bean("Company", company[0]).save() \ No newline at end of file diff --git a/patches/march_2013/p08_create_aii_accounts.py b/patches/march_2013/p08_create_aii_accounts.py index ec186b47ff..30bfe9ef01 100644 --- a/patches/march_2013/p08_create_aii_accounts.py +++ b/patches/march_2013/p08_create_aii_accounts.py @@ -1,7 +1,7 @@ import webnotes def execute(): webnotes.reload_doc("setup", "doctype", "company") - + create_chart_of_accounts_if_not_exists() add_group_accounts() add_ledger_accounts() add_aii_cost_center() @@ -94,4 +94,10 @@ def add_aii_cost_center(): }) cc.insert() +def create_chart_of_accounts_if_not_exists(): + for company in webnotes.conn.sql("select name from `tabCompany`"): + if not webnotes.conn.sql("select * from `tabAccount` where company = %s", company[0]): + webnotes.conn.sql("""update `tabCompany` set receivables_group = '', + payables_group = '' where name = %s""", company[0]) + webnotes.bean("Company", company[0]).save() \ No newline at end of file diff --git a/patches/patch_list.py b/patches/patch_list.py index 4c51e8d710..b827c5b482 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -230,7 +230,6 @@ patch_list = [ "patches.march_2013.p11_update_attach_files", "patches.march_2013.p12_set_item_tax_rate_in_json", "patches.march_2013.p07_update_valuation_rate", - "patches.april_2013.p05_create_chart_of_accounts", "patches.march_2013.p08_create_aii_accounts", "patches.march_2013.p03_update_buying_amount", "patches.april_2013.p01_update_serial_no_valuation_rate",