coa: minor fix

This commit is contained in:
Nabin Hait 2014-03-21 18:30:46 +05:30
parent 425bfc5c8d
commit 06a595090d
3 changed files with 7 additions and 5 deletions

View File

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

View File

@ -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,''],

View File

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