[patch] create chart of accounts if not created
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 3a38a2c..0000000
--- 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 ec186b4..30bfe9e 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 @@
})
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 4c51e8d..b827c5b 100644
--- a/patches/patch_list.py
+++ b/patches/patch_list.py
@@ -230,7 +230,6 @@
"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",