From 3594873a638afe1364f19d0f0ff8eaae3b4ba2ee Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 9 Apr 2013 14:49:00 +0530 Subject: [PATCH] [patch] create chart of accounts if not created --- patches/april_2013/p05_create_chart_of_accounts.py | 7 +++++++ 1 file changed, 7 insertions(+) create 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 new file mode 100644 index 0000000000..3a38a2c863 --- /dev/null +++ b/patches/april_2013/p05_create_chart_of_accounts.py @@ -0,0 +1,7 @@ +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