[patch] create chart of accounts if not created

This commit is contained in:
Nabin Hait 2013-04-09 14:56:30 +05:30
parent 3594873a63
commit 5639035268
3 changed files with 7 additions and 9 deletions

View File

@ -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()

View File

@ -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()

View File

@ -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",