From 06a595090d90da53d5b1331c3bd8c874ec641a93 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 21 Mar 2014 18:30:46 +0530 Subject: [PATCH] coa: minor fix --- .../accounts/doctype/chart_of_accounts/chart_of_accounts.py | 6 ++++-- erpnext/setup/doctype/company/company.py | 4 ++-- erpnext/setup/doctype/company/test_company.py | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/doctype/chart_of_accounts/chart_of_accounts.py b/erpnext/accounts/doctype/chart_of_accounts/chart_of_accounts.py index 333f5c3689..16c6acff58 100644 --- a/erpnext/accounts/doctype/chart_of_accounts/chart_of_accounts.py +++ b/erpnext/accounts/doctype/chart_of_accounts/chart_of_accounts.py @@ -23,6 +23,7 @@ class DocType: if chart: accounts = [] + def _import_accounts(children, parent): for child in children: account_name = child.get("name") @@ -31,8 +32,9 @@ class DocType: if account_name_in_db in accounts: count = accounts.count(account_name_in_db) account_name = account_name + " " + cstr(count) - - child.update(account_properties.get(chart.get("name"), {}).get(account_name)) + + child.update(account_properties.get(chart.get("name"), {})\ + .get(account_name, {})) account = frappe.bean({ "doctype": "Account", diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py index cc3253f13e..3d62b2dfd8 100644 --- a/erpnext/setup/doctype/company/company.py +++ b/erpnext/setup/doctype/company/company.py @@ -119,9 +119,9 @@ class DocType: "freeze_account": "No", "master_type": "", }) + for d in self.fld_dict.keys(): account.doc.fields[d] = (d == 'parent_account' and lst[self.fld_dict[d]]) and lst[self.fld_dict[d]] +' - '+ self.doc.abbr or lst[self.fld_dict[d]] - account.insert() def set_default_accounts(self): @@ -273,7 +273,7 @@ class DocType: ['Direct Income','Income','Group','Income Account','Profit and Loss',self.doc.name,''], ['Sales','Direct Income','Ledger','Income Account','Profit and Loss',self.doc.name,''], ['Service','Direct Income','Ledger','Income Account','Profit and Loss',self.doc.name,''], - ['Indirect Income','Profit and Loss','Group','Income Account','Profit and Loss',self.doc.name,''], + ['Indirect Income','Income','Group','Income Account','Profit and Loss',self.doc.name,''], ['Source of Funds (Liabilities)','','Group','','Balance Sheet',self.doc.name,''], ['Capital Account','Source of Funds (Liabilities)','Group','','Balance Sheet',self.doc.name,''], ['Reserves and Surplus','Capital Account','Ledger','','Balance Sheet',self.doc.name,''], diff --git a/erpnext/setup/doctype/company/test_company.py b/erpnext/setup/doctype/company/test_company.py index 8c12fc7786..9d5756a3d8 100644 --- a/erpnext/setup/doctype/company/test_company.py +++ b/erpnext/setup/doctype/company/test_company.py @@ -9,7 +9,7 @@ import unittest class TestCompany(unittest.TestCase): def test_coa(self): for country, chart_name in frappe.db.sql("""select country, chart_name - from `tabChart of Accounts` where country="India" order by country""", as_list=1): + from `tabChart of Accounts` where name = 'Deutscher Kontenplan SKR03'""", as_list=1): print "Country: ", country print "Chart Name: ", chart_name