diff --git a/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py b/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py index eaa96513e5..b3105f5392 100644 --- a/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py +++ b/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py @@ -9,8 +9,6 @@ from unidecode import unidecode def create_charts(chart_name, company): chart = get_chart(chart_name) - frappe.db.sql("delete from `tabAccount` where company=%s", company) - if chart: accounts = [] diff --git a/erpnext/accounts/doctype/account/chart_of_accounts/standard_chart_of_accounts.py b/erpnext/accounts/doctype/account/chart_of_accounts/standard_chart_of_accounts.py index d5d3d5e988..07cf3d9b8a 100644 --- a/erpnext/accounts/doctype/account/chart_of_accounts/standard_chart_of_accounts.py +++ b/erpnext/accounts/doctype/account/chart_of_accounts/standard_chart_of_accounts.py @@ -1,592 +1,176 @@ -{ - "_(\"Accounts Payable\")": { - "_(\"Creditors\")": { - "account_type": "Payable" - } - }, - "_(\"Accounts Receivable\")": { - "_(\"Debtors\")": { - "account_type": "Receivable" - } - }, - "_(\"Administrative Expenses\")": { - "account_type": "Expense Account" - }, - "_(\"Application of Funds (Assets)\")": { - "_(\"Current Assets\")": { - "_(\"Accounts Receivable\")": { - "_(\"Debtors\")": { +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +from frappe import _ + +coa = { + _("Application of Funds (Assets)"): { + _("Current Assets"): { + _("Accounts Receivable"): { + _("Debtors"): { "account_type": "Receivable" } - }, - "_(\"Bank Accounts\")": { + }, + _("Bank Accounts"): { "account_type": "Bank" - }, - "_(\"Cash In Hand\")": { - "_(\"Cash\")": { + }, + _("Cash In Hand"): { + _("Cash"): { "account_type": "Cash" - }, + }, "account_type": "Cash" - }, - "_(\"Loans and Advances (Assets)\")": {}, - "_(\"Securities and Deposits\")": { - "_(\"Earnest Money\")": {} - }, - "_(\"Stock Assets\")": { + }, + _("Loans and Advances (Assets)"): {}, + _("Securities and Deposits"): { + _("Earnest Money"): {} + }, + _("Stock Assets"): { "account_type": "Stock" - }, - "_(\"Tax Assets\")": {} - }, - "_(\"Fixed Assets\")": { - "_(\"Capital Equipments\")": { + }, + _("Tax Assets"): {} + }, + _("Fixed Assets"): { + _("Capital Equipments"): { "account_type": "Fixed Asset" - }, - "_(\"Computers\")": { + }, + _("Computers"): { "account_type": "Fixed Asset" - }, - "_(\"Furniture and Fixture\")": { + }, + _("Furniture and Fixture"): { "account_type": "Fixed Asset" - }, - "_(\"Office Equipments\")": { + }, + _("Office Equipments"): { "account_type": "Fixed Asset" - }, - "_(\"Plant and Machinery\")": { + }, + _("Plant and Machinery"): { "account_type": "Fixed Asset" } - }, - "_(\"Investments\")": {}, - "_(\"Temporary Accounts (Assets)\")": { - "_(\"Temporary Assets\")": {} - } - }, - "_(\"Bank Accounts\")": { - "account_type": "Bank" - }, - "_(\"Bank Overdraft Account\")": {}, - "_(\"Capital Account\")": { - "_(\"Reserves and Surplus\")": {}, - "_(\"Shareholders Funds\")": {} - }, - "_(\"Capital Equipments\")": { - "account_type": "Fixed Asset" - }, - "_(\"Cash In Hand\")": { - "_(\"Cash\")": { - "account_type": "Cash" - }, - "account_type": "Cash" - }, - "_(\"Cash\")": { - "account_type": "Cash" - }, - "_(\"Charity and Donations\")": { - "account_type": "Expense Account" - }, - "_(\"Commission on Sales\")": { - "account_type": "Expense Account" - }, - "_(\"Computers\")": { - "account_type": "Fixed Asset" - }, - "_(\"Cost of Goods Sold\")": { - "account_type": "Expense Account" - }, - "_(\"Creditors\")": { - "account_type": "Payable" - }, - "_(\"Current Assets\")": { - "_(\"Accounts Receivable\")": { - "_(\"Debtors\")": { - "account_type": "Receivable" - } - }, - "_(\"Bank Accounts\")": { - "account_type": "Bank" - }, - "_(\"Cash In Hand\")": { - "_(\"Cash\")": { - "account_type": "Cash" - }, - "account_type": "Cash" - }, - "_(\"Loans and Advances (Assets)\")": {}, - "_(\"Securities and Deposits\")": { - "_(\"Earnest Money\")": {} - }, - "_(\"Stock Assets\")": { - "account_type": "Stock" - }, - "_(\"Tax Assets\")": {} - }, - "_(\"Current Liabilities\")": {}, - "_(\"Debtors\")": { - "account_type": "Receivable" - }, - "_(\"Depreciation\")": { - "account_type": "Expense Account" - }, - "_(\"Direct Expenses\")": { - "_(\"Stock Expenses\")": { - "_(\"Cost of Goods Sold\")": { - "account_type": "Expense Account" - }, - "_(\"Expenses Included In Valuation\")": { - "account_type": "Expenses Included In Valuation" - }, - "_(\"Stock Adjustment\")": { - "account_type": "Stock Adjustment" - }, - "account_type": "Expense Account" - }, - "account_type": "Expense Account" - }, - "_(\"Direct Income\")": { - "_(\"Sales\")": { - "account_type": "Income Account" - }, - "_(\"Service\")": { - "account_type": "Income Account" - }, - "account_type": "Income Account" - }, - "_(\"Duties and Taxes\")": {}, - "_(\"Earnest Money\")": {}, - "_(\"Entertainment Expenses\")": { - "account_type": "Expense Account" - }, - "_(\"Expenses Included In Valuation\")": { - "account_type": "Expenses Included In Valuation" - }, - "_(\"Expenses\")": { - "_(\"Direct Expenses\")": { - "_(\"Stock Expenses\")": { - "_(\"Cost of Goods Sold\")": { + }, + _("Investments"): {}, + _("Temporary Accounts (Assets)"): { + _("Temporary Assets"): {} + }, + "root_type": "Asset" + }, + _("Expenses"): { + _("Direct Expenses"): { + _("Stock Expenses"): { + _("Cost of Goods Sold"): { "account_type": "Expense Account" - }, - "_(\"Expenses Included In Valuation\")": { + }, + _("Expenses Included In Valuation"): { "account_type": "Expenses Included In Valuation" - }, - "_(\"Stock Adjustment\")": { + }, + _("Stock Adjustment"): { "account_type": "Stock Adjustment" - }, + }, "account_type": "Expense Account" - }, + }, "account_type": "Expense Account" - }, - "_(\"Indirect Expenses\")": { - "_(\"Administrative Expenses\")": { + }, + _("Indirect Expenses"): { + _("Administrative Expenses"): { "account_type": "Expense Account" - }, - "_(\"Charity and Donations\")": { + }, + _("Commission on Sales"): { "account_type": "Expense Account" - }, - "_(\"Commission on Sales\")": { + }, + _("Depreciation"): { "account_type": "Expense Account" - }, - "_(\"Depreciation\")": { + }, + _("Entertainment Expenses"): { "account_type": "Expense Account" - }, - "_(\"Entertainment Expenses\")": { - "account_type": "Expense Account" - }, - "_(\"Freight and Forwarding Charges\")": { + }, + _("Freight and Forwarding Charges"): { "account_type": "Chargeable" - }, - "_(\"Legal Expenses\")": { + }, + _("Legal Expenses"): { "account_type": "Expense Account" - }, - "_(\"Marketing Expenses\")": { + }, + _("Marketing Expenses"): { "account_type": "Chargeable" - }, - "_(\"Miscellaneous Expenses\")": { + }, + _("Miscellaneous Expenses"): { "account_type": "Chargeable" - }, - "_(\"Office Maintenance Expenses\")": { + }, + _("Office Maintenance Expenses"): { "account_type": "Expense Account" - }, - "_(\"Office Rent\")": { + }, + _("Office Rent"): { "account_type": "Expense Account" - }, - "_(\"Postal Expenses\")": { + }, + _("Postal Expenses"): { "account_type": "Expense Account" - }, - "_(\"Print and Stationary\")": { + }, + _("Print and Stationary"): { "account_type": "Expense Account" - }, - "_(\"Rounded Off\")": { + }, + _("Rounded Off"): { "account_type": "Expense Account" - }, - "_(\"Salary\")": { + }, + _("Salary"): { "account_type": "Expense Account" - }, - "_(\"Sales Expenses\")": { + }, + _("Sales Expenses"): { "account_type": "Expense Account" - }, - "_(\"Telephone Expenses\")": { + }, + _("Telephone Expenses"): { "account_type": "Expense Account" - }, - "_(\"Travel Expenses\")": { + }, + _("Travel Expenses"): { "account_type": "Expense Account" - }, - "_(\"Utility Expenses\")": { + }, + _("Utility Expenses"): { "account_type": "Expense Account" - }, + }, "account_type": "Expense Account" - }, - "account_type": "Expense Account" - }, - "_(\"Fixed Assets\")": { - "_(\"Capital Equipments\")": { - "account_type": "Fixed Asset" - }, - "_(\"Computers\")": { - "account_type": "Fixed Asset" - }, - "_(\"Furniture and Fixture\")": { - "account_type": "Fixed Asset" - }, - "_(\"Office Equipments\")": { - "account_type": "Fixed Asset" - }, - "_(\"Plant and Machinery\")": { - "account_type": "Fixed Asset" - } - }, - "_(\"Freight and Forwarding Charges\")": { - "account_type": "Chargeable" - }, - "_(\"Furniture and Fixture\")": { - "account_type": "Fixed Asset" - }, - "_(\"Income\")": { - "_(\"Direct Income\")": { - "_(\"Sales\")": { + }, + "root_type": "Expense" + }, + _("Income"): { + _("Direct Income"): { + _("Sales"): { "account_type": "Income Account" - }, - "_(\"Service\")": { + }, + _("Service"): { "account_type": "Income Account" - }, + }, "account_type": "Income Account" - }, - "_(\"Indirect Income\")": { + }, + _("Indirect Income"): { "account_type": "Income Account" - } - }, - "_(\"Indirect Expenses\")": { - "_(\"Administrative Expenses\")": { - "account_type": "Expense Account" - }, - "_(\"Charity and Donations\")": { - "account_type": "Expense Account" - }, - "_(\"Commission on Sales\")": { - "account_type": "Expense Account" - }, - "_(\"Depreciation\")": { - "account_type": "Expense Account" - }, - "_(\"Entertainment Expenses\")": { - "account_type": "Expense Account" - }, - "_(\"Freight and Forwarding Charges\")": { - "account_type": "Chargeable" - }, - "_(\"Legal Expenses\")": { - "account_type": "Expense Account" - }, - "_(\"Marketing Expenses\")": { - "account_type": "Chargeable" - }, - "_(\"Miscellaneous Expenses\")": { - "account_type": "Chargeable" - }, - "_(\"Office Maintenance Expenses\")": { - "account_type": "Expense Account" - }, - "_(\"Office Rent\")": { - "account_type": "Expense Account" - }, - "_(\"Postal Expenses\")": { - "account_type": "Expense Account" - }, - "_(\"Print and Stationary\")": { - "account_type": "Expense Account" - }, - "_(\"Rounded Off\")": { - "account_type": "Expense Account" - }, - "_(\"Salary\")": { - "account_type": "Expense Account" - }, - "_(\"Sales Expenses\")": { - "account_type": "Expense Account" - }, - "_(\"Telephone Expenses\")": { - "account_type": "Expense Account" - }, - "_(\"Travel Expenses\")": { - "account_type": "Expense Account" - }, - "_(\"Utility Expenses\")": { - "account_type": "Expense Account" - }, - "account_type": "Expense Account" - }, - "_(\"Indirect Income\")": { - "account_type": "Income Account" - }, - "_(\"Investments\")": {}, - "_(\"Legal Expenses\")": { - "account_type": "Expense Account" - }, - "_(\"Loans (Liabilities)\")": {}, - "_(\"Loans and Advances (Assets)\")": {}, - "_(\"Marketing Expenses\")": { - "account_type": "Chargeable" - }, - "_(\"Miscellaneous Expenses\")": { - "account_type": "Chargeable" - }, - "_(\"Office Equipments\")": { - "account_type": "Fixed Asset" - }, - "_(\"Office Maintenance Expenses\")": { - "account_type": "Expense Account" - }, - "_(\"Office Rent\")": { - "account_type": "Expense Account" - }, - "_(\"Plant and Machinery\")": { - "account_type": "Fixed Asset" - }, - "_(\"Postal Expenses\")": { - "account_type": "Expense Account" - }, - "_(\"Print and Stationary\")": { - "account_type": "Expense Account" - }, - "_(\"Reserves and Surplus\")": {}, - "_(\"Rounded Off\")": { - "account_type": "Expense Account" - }, - "_(\"Salary\")": { - "account_type": "Expense Account" - }, - "_(\"Sales Expenses\")": { - "account_type": "Expense Account" - }, - "_(\"Sales\")": { - "account_type": "Income Account" - }, - "_(\"Secured Loans\")": {}, - "_(\"Securities and Deposits\")": { - "_(\"Earnest Money\")": {} - }, - "_(\"Service\")": { - "account_type": "Income Account" - }, - "_(\"Shareholders Funds\")": {}, - "_(\"Source of Funds (Liabilities)\")": { - "_(\"Capital Account\")": { - "_(\"Reserves and Surplus\")": {}, - "_(\"Shareholders Funds\")": {} - }, - "_(\"Current Liabilities\")": {}, - "_(\"Temporary Accounts (Liabilities)\")": { - "_(\"Temporary Liabilities\")": {} - } - }, - "_(\"Stock Adjustment\")": { - "account_type": "Stock Adjustment" - }, - "_(\"Stock Assets\")": { - "account_type": "Stock" - }, - "_(\"Stock Expenses\")": { - "_(\"Cost of Goods Sold\")": { - "account_type": "Expense Account" - }, - "_(\"Expenses Included In Valuation\")": { - "account_type": "Expenses Included In Valuation" - }, - "_(\"Stock Adjustment\")": { - "account_type": "Stock Adjustment" - }, - "account_type": "Expense Account" - }, - "_(\"Stock Liabilities\")": {}, - "_(\"Stock Received But Not Billed\")": { - "account_type": "Stock Received But Not Billed" - }, - "_(\"Tax Assets\")": {}, - "_(\"Telephone Expenses\")": { - "account_type": "Expense Account" - }, - "_(\"Temporary Accounts (Assets)\")": { - "_(\"Temporary Assets\")": {} - }, - "_(\"Temporary Accounts (Liabilities)\")": { - "_(\"Temporary Liabilities\")": {} - }, - "_(\"Temporary Assets\")": {}, - "_(\"Temporary Liabilities\")": {}, - "_(\"Travel Expenses\")": { - "account_type": "Expense Account" - }, - "_(\"Unsecured Loans\")": {}, - "_(\"Utility Expenses\")": { - "account_type": "Expense Account" - }, - "root": { - "_(\"Application of Funds (Assets)\")": { - "_(\"Current Assets\")": { - "_(\"Accounts Receivable\")": { - "_(\"Debtors\")": { - "account_type": "Receivable" - } - }, - "_(\"Bank Accounts\")": { - "account_type": "Bank" - }, - "_(\"Cash In Hand\")": { - "_(\"Cash\")": { - "account_type": "Cash" - }, - "account_type": "Cash" - }, - "_(\"Loans and Advances (Assets)\")": {}, - "_(\"Securities and Deposits\")": { - "_(\"Earnest Money\")": {} - }, - "_(\"Stock Assets\")": { - "account_type": "Stock" - }, - "_(\"Tax Assets\")": {} - }, - "_(\"Fixed Assets\")": { - "_(\"Capital Equipments\")": { - "account_type": "Fixed Asset" - }, - "_(\"Computers\")": { - "account_type": "Fixed Asset" - }, - "_(\"Furniture and Fixture\")": { - "account_type": "Fixed Asset" - }, - "_(\"Office Equipments\")": { - "account_type": "Fixed Asset" - }, - "_(\"Plant and Machinery\")": { - "account_type": "Fixed Asset" - } - }, - "_(\"Investments\")": {}, - "_(\"Temporary Accounts (Assets)\")": { - "_(\"Temporary Assets\")": {} - } - }, - "_(\"Expenses\")": { - "_(\"Direct Expenses\")": { - "_(\"Stock Expenses\")": { - "_(\"Cost of Goods Sold\")": { - "account_type": "Expense Account" - }, - "_(\"Expenses Included In Valuation\")": { - "account_type": "Expenses Included In Valuation" - }, - "_(\"Stock Adjustment\")": { - "account_type": "Stock Adjustment" - }, - "account_type": "Expense Account" - }, - "account_type": "Expense Account" - }, - "_(\"Indirect Expenses\")": { - "_(\"Administrative Expenses\")": { - "account_type": "Expense Account" - }, - "_(\"Charity and Donations\")": { - "account_type": "Expense Account" - }, - "_(\"Commission on Sales\")": { - "account_type": "Expense Account" - }, - "_(\"Depreciation\")": { - "account_type": "Expense Account" - }, - "_(\"Entertainment Expenses\")": { - "account_type": "Expense Account" - }, - "_(\"Freight and Forwarding Charges\")": { - "account_type": "Chargeable" - }, - "_(\"Legal Expenses\")": { - "account_type": "Expense Account" - }, - "_(\"Marketing Expenses\")": { - "account_type": "Chargeable" - }, - "_(\"Miscellaneous Expenses\")": { - "account_type": "Chargeable" - }, - "_(\"Office Maintenance Expenses\")": { - "account_type": "Expense Account" - }, - "_(\"Office Rent\")": { - "account_type": "Expense Account" - }, - "_(\"Postal Expenses\")": { - "account_type": "Expense Account" - }, - "_(\"Print and Stationary\")": { - "account_type": "Expense Account" - }, - "_(\"Rounded Off\")": { - "account_type": "Expense Account" - }, - "_(\"Salary\")": { - "account_type": "Expense Account" - }, - "_(\"Sales Expenses\")": { - "account_type": "Expense Account" - }, - "_(\"Telephone Expenses\")": { - "account_type": "Expense Account" - }, - "_(\"Travel Expenses\")": { - "account_type": "Expense Account" - }, - "_(\"Utility Expenses\")": { - "account_type": "Expense Account" - }, - "account_type": "Expense Account" - }, - "account_type": "Expense Account" - }, - "_(\"Income\")": { - "_(\"Direct Income\")": { - "_(\"Sales\")": { - "account_type": "Income Account" - }, - "_(\"Service\")": { - "account_type": "Income Account" - }, - "account_type": "Income Account" - }, - "_(\"Indirect Income\")": { - "account_type": "Income Account" - } - }, - "_(\"Source of Funds (Liabilities)\")": { - "_(\"Capital Account\")": { - "_(\"Reserves and Surplus\")": {}, - "_(\"Shareholders Funds\")": {} - }, - "_(\"Current Liabilities\")": {}, - "_(\"Temporary Accounts (Liabilities)\")": { - "_(\"Temporary Liabilities\")": {} - } - }, - "root_type": "true" + }, + "root_type": "Income" + }, + _("Source of Funds (Liabilities)"): { + _("Capital Account"): { + _("Reserves and Surplus"): {}, + _("Shareholders Funds"): {} + }, + _("Current Liabilities"): { + _("Accounts Payable"): { + _("Creditors"): { + "account_type": "Payable" + } + }, + _("Stock Liabilities"): { + _("Stock Received But Not Billed"): { + "account_type": "Stock Received But Not Billed" + }, + }, + _("Duties and Taxes"): { + "account_type": "Tax" + }, + _("Loans (Liabilities)"): { + _("Secured Loans"): {}, + _("Unsecured Loans"): {}, + _("Bank Overdraft Account"): {}, + }, + }, + _("Temporary Accounts (Liabilities)"): { + _("Temporary Liabilities"): {} + }, + "root_type": "Liability" } -} \ No newline at end of file +} diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py index f0130d64fc..5868fd4cf8 100644 --- a/erpnext/setup/doctype/company/company.py +++ b/erpnext/setup/doctype/company/company.py @@ -49,11 +49,11 @@ class Company(Document): .format(self.get(field), self.name)) def on_update(self): - # if not frappe.db.sql("""select name from tabAccount - # where company=%s and docstatus<2 limit 1""", self.name): - self.create_default_accounts() - self.create_default_warehouses() - self.install_country_fixtures() + if not frappe.db.sql("""select name from tabAccount + where company=%s and docstatus<2 limit 1""", self.name): + self.create_default_accounts() + self.create_default_warehouses() + self.install_country_fixtures() if not frappe.db.get_value("Cost Center", {"group_or_ledger": "Ledger", "company": self.name}): self.create_default_cost_center() @@ -86,8 +86,6 @@ class Company(Document): else: from erpnext.accounts.doctype.account.chart_of_accounts.chart_of_accounts import create_charts create_charts(self.chart_of_accounts, self.name) - # else: - # self.create_standard_accounts() frappe.db.set(self, "default_receivable_account", frappe.db.get_value("Account", {"company": self.name, "account_type": "Receivable"})) @@ -191,92 +189,6 @@ class Company(Document): frappe.defaults.clear_cache() - def create_standard_accounts(self): - self.fld_dict = { - 'account_name': 0, - 'parent_account': 1, - 'group_or_ledger': 2, - 'account_type': 3, - 'report_type': 4, - 'tax_rate': 5, - 'root_type': 6 - } - - acc_list_common = [ - [_('Application of Funds (Assets)'), None,'Group', None,'Balance Sheet', None, 'Asset'], - [_('Current Assets'),_('Application of Funds (Assets)'),'Group', None,'Balance Sheet', None, 'Asset'], - [_('Accounts Receivable'),_('Current Assets'),'Group', None,'Balance Sheet', None, 'Asset'], - [_('Debtors'), _('Accounts Receivable'),'Ledger', 'Receivable','Balance Sheet', None, 'Asset'], - [_('Bank Accounts'),_('Current Assets'),'Group','Bank','Balance Sheet', None, 'Asset'], - [_('Cash In Hand'),_('Current Assets'),'Group','Cash','Balance Sheet', None, 'Asset'], - [_('Cash'),_('Cash In Hand'),'Ledger','Cash','Balance Sheet', None, 'Asset'], - [_('Loans and Advances (Assets)'),_('Current Assets'),'Group', None,'Balance Sheet', None, 'Asset'], - [_('Securities and Deposits'),_('Current Assets'),'Group', None,'Balance Sheet', None, 'Asset'], - [_('Earnest Money'),_('Securities and Deposits'),'Ledger', None,'Balance Sheet', None, 'Asset'], - [_('Stock Assets'),_('Current Assets'),'Group','Stock','Balance Sheet', None, 'Asset'], - [_('Tax Assets'),_('Current Assets'),'Group', None,'Balance Sheet', None, 'Asset'], - [_('Fixed Assets'),_('Application of Funds (Assets)'),'Group', None,'Balance Sheet', None, 'Asset'], - [_('Capital Equipments'),_('Fixed Assets'),'Ledger','Fixed Asset','Balance Sheet', None, 'Asset'], - [_('Computers'),_('Fixed Assets'),'Ledger','Fixed Asset','Balance Sheet', None, 'Asset'], - [_('Furniture and Fixture'),_('Fixed Assets'),'Ledger','Fixed Asset','Balance Sheet', None, 'Asset'], - [_('Office Equipments'),_('Fixed Assets'),'Ledger','Fixed Asset','Balance Sheet', None, 'Asset'], - [_('Plant and Machinery'),_('Fixed Assets'),'Ledger','Fixed Asset','Balance Sheet', None, 'Asset'], - [_('Investments'),_('Application of Funds (Assets)'),'Group', None,'Balance Sheet', None, 'Asset'], - [_('Temporary Accounts (Assets)'),_('Application of Funds (Assets)'),'Group', None,'Balance Sheet', None, 'Asset'], - [_('Temporary Assets'),_('Temporary Accounts (Assets)'),'Ledger', None,'Balance Sheet', None, 'Asset'], - [_('Expenses'), None,'Group','Expense Account','Profit and Loss', None, 'Expense'], - [_('Direct Expenses'),_('Expenses'),'Group','Expense Account','Profit and Loss', None, 'Expense'], - [_('Stock Expenses'),_('Direct Expenses'),'Group','Expense Account','Profit and Loss', None, 'Expense'], - [_('Cost of Goods Sold'),_('Stock Expenses'),'Ledger','Expense Account','Profit and Loss', None, 'Expense'], - [_('Stock Adjustment'),_('Stock Expenses'),'Ledger','Stock Adjustment','Profit and Loss', None, 'Expense'], - [_('Expenses Included In Valuation'), _("Stock Expenses"), 'Ledger', 'Expenses Included In Valuation', 'Profit and Loss', None, 'Expense'], - [_('Indirect Expenses'), _('Expenses'),'Group','Expense Account','Profit and Loss', None, 'Expense'], - [_('Marketing Expenses'), _('Indirect Expenses'),'Ledger','Chargeable','Profit and Loss', None, 'Expense'], - [_('Sales Expenses'), _('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss', None, 'Expense'], - [_('Administrative Expenses'), _('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss', None, 'Expense'], - [_('Charity and Donations'), _('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss', None, 'Expense'], - [_('Commission on Sales'), _('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss', None, 'Expense'], - [_('Travel Expenses'), _('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss', None, 'Expense'], - [_('Entertainment Expenses'), _('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss', None, 'Expense'], - [_('Depreciation'), _('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss', None, 'Expense'], - [_('Freight and Forwarding Charges'), _('Indirect Expenses'),'Ledger','Chargeable','Profit and Loss', None, 'Expense'], - [_('Legal Expenses'), _('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss', None, 'Expense'], - [_('Miscellaneous Expenses'), _('Indirect Expenses'),'Ledger','Chargeable','Profit and Loss', None, 'Expense'], - [_('Office Maintenance Expenses'), _('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss', None, 'Expense'], - [_('Office Rent'), _('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss', None, 'Expense'], - [_('Postal Expenses'), _('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss', None, 'Expense'], - [_('Print and Stationary'), _('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss', None, 'Expense'], - [_('Rounded Off'), _('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss', None, 'Expense'], - [_('Salary') ,_('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss', None, 'Expense'], - [_('Telephone Expenses') ,_('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss', None, 'Expense'], - [_('Utility Expenses') ,_('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss', None, 'Expense'], - [_('Income'), None,'Group', None,'Profit and Loss', None, 'Income'], - [_('Direct Income'),_('Income'),'Group','Income Account','Profit and Loss', None, 'Income'], - [_('Sales'),_('Direct Income'),'Ledger','Income Account','Profit and Loss', None, 'Income'], - [_('Service'),_('Direct Income'),'Ledger','Income Account','Profit and Loss', None, 'Income'], - [_('Indirect Income'),_('Income'),'Group','Income Account','Profit and Loss', None, 'Income'], - [_('Source of Funds (Liabilities)'), None,'Group', None,'Balance Sheet', None, 'Liability'], - [_('Capital Account'),_('Source of Funds (Liabilities)'),'Group', None,'Balance Sheet', None, 'Liability'], - [_('Reserves and Surplus'),_('Capital Account'),'Ledger', None,'Balance Sheet', None, 'Liability'], - [_('Shareholders Funds'),_('Capital Account'),'Ledger', None,'Balance Sheet', None, 'Liability'], - [_('Current Liabilities'),_('Source of Funds (Liabilities)'),'Group', None,'Balance Sheet', None, 'Liability'], - [_('Accounts Payable'),_('Current Liabilities'),'Group', None,'Balance Sheet', None, 'Liability'], - [_('Creditors'), _('Accounts Payable'),'Ledger', 'Payable','Balance Sheet', None, 'Liability'], - [_('Stock Liabilities'),_('Current Liabilities'),'Group', None,'Balance Sheet', None, 'Liability'], - [_('Stock Received But Not Billed'), _('Stock Liabilities'), 'Ledger', 'Stock Received But Not Billed', 'Balance Sheet', None, 'Liability'], - [_('Duties and Taxes'),_('Current Liabilities'),'Group', None,'Balance Sheet', None, 'Liability'], - [_('Loans (Liabilities)'),_('Current Liabilities'),'Group', None,'Balance Sheet', None, 'Liability'], - [_('Secured Loans'),_('Loans (Liabilities)'),'Group', None,'Balance Sheet', None, 'Liability'], - [_('Unsecured Loans'),_('Loans (Liabilities)'),'Group', None,'Balance Sheet', None, 'Liability'], - [_('Bank Overdraft Account'),_('Loans (Liabilities)'),'Group', None,'Balance Sheet', None, 'Liability'], - [_('Temporary Accounts (Liabilities)'),_('Source of Funds (Liabilities)'),'Group', None,'Balance Sheet', None, 'Liability'], - [_('Temporary Liabilities'),_('Temporary Accounts (Liabilities)'),'Ledger', None,'Balance Sheet', None, 'Liability'] - ] - - # load common account heads - for d in acc_list_common: - self.add_acc(d) - @frappe.whitelist() def replace_abbr(company, old, new): frappe.only_for("System Manager") diff --git a/erpnext/setup/doctype/company/fixtures/india/__init__.py b/erpnext/setup/doctype/company/fixtures/india/__init__.py index 3e7e973f19..4646eae6dd 100644 --- a/erpnext/setup/doctype/company/fixtures/india/__init__.py +++ b/erpnext/setup/doctype/company/fixtures/india/__init__.py @@ -4,7 +4,6 @@ from __future__ import unicode_literals import frappe -from frappe import _ def install(company): docs = [ @@ -18,65 +17,3 @@ def install(company): frappe.get_doc(d).insert() except frappe.NameError: pass - - - # accounts - - # fld_dict = { - # 'account_name': 0, - # 'parent_account': 1, - # 'group_or_ledger': 2, - # 'account_type': 3, - # 'report_type': 4, - # 'tax_rate': 5, - # 'root_type': 6 - # } - # - # acc_list_india = [ - # [_('CENVAT Capital Goods'),_(_('Tax Assets')),'Ledger','Chargeable','Balance Sheet', None, 'Asset'], - # [_('CENVAT'),_('Tax Assets'),'Ledger','Chargeable','Balance Sheet', None, 'Asset'], - # [_('CENVAT Service Tax'),_('Tax Assets'),'Ledger','Chargeable','Balance Sheet', None, 'Asset'], - # [_('CENVAT Service Tax Cess 1'),_('Tax Assets'),'Ledger','Chargeable','Balance Sheet', None, 'Asset'], - # [_('CENVAT Service Tax Cess 2'),_('Tax Assets'),'Ledger','Chargeable','Balance Sheet', None, 'Asset'], - # [_('CENVAT Edu Cess'),_('Tax Assets'),'Ledger','Chargeable','Balance Sheet', None, 'Asset'], - # [_('CENVAT SHE Cess'),_('Tax Assets'),'Ledger','Chargeable','Balance Sheet', None, 'Asset'], - # [_('Excise Duty 4'),_('Tax Assets'),'Ledger','Tax','Balance Sheet','4.00', 'Asset'], - # [_('Excise Duty 8'),_('Tax Assets'),'Ledger','Tax','Balance Sheet','8.00', 'Asset'], - # [_('Excise Duty 10'),_('Tax Assets'),'Ledger','Tax','Balance Sheet','10.00', 'Asset'], - # [_('Excise Duty 14'),_('Tax Assets'),'Ledger','Tax','Balance Sheet','14.00', 'Asset'], - # [_('Excise Duty Edu Cess 2'),_('Tax Assets'),'Ledger','Tax','Balance Sheet','2.00', 'Asset'], - # [_('Excise Duty SHE Cess 1'),_('Tax Assets'),'Ledger','Tax','Balance Sheet','1.00', 'Asset'], - # [_('P L A'),_('Tax Assets'),'Ledger','Chargeable','Balance Sheet', None, 'Asset'], - # [_('P L A - Cess Portion'),_('Tax Assets'),'Ledger','Chargeable','Balance Sheet', None, 'Asset'], - # [_('Edu. Cess on Excise'),_('Duties and Taxes'),'Ledger','Tax','Balance Sheet','2.00', 'Liability'], - # [_('Edu. Cess on Service Tax'),_('Duties and Taxes'),'Ledger','Tax','Balance Sheet','2.00', 'Liability'], - # [_('Edu. Cess on TDS'),_('Duties and Taxes'),'Ledger','Tax','Balance Sheet','2.00', 'Liability'], - # [_('Excise Duty @ 4'),_('Duties and Taxes'),'Ledger','Tax','Balance Sheet','4.00', 'Liability'], - # [_('Excise Duty @ 8'),_('Duties and Taxes'),'Ledger','Tax','Balance Sheet','8.00', 'Liability'], - # [_('Excise Duty @ 10'),_('Duties and Taxes'),'Ledger','Tax','Balance Sheet','10.00', 'Liability'], - # [_('Excise Duty @ 14'),_('Duties and Taxes'),'Ledger','Tax','Balance Sheet','14.00', 'Liability'], - # [_('Service Tax'),_('Duties and Taxes'),'Ledger','Tax','Balance Sheet','10.3', 'Liability'], - # [_('SHE Cess on Excise'),_('Duties and Taxes'),'Ledger','Tax','Balance Sheet','1.00', 'Liability'], - # [_('SHE Cess on Service Tax'),_('Duties and Taxes'),'Ledger','Tax','Balance Sheet','1.00', 'Liability'], - # [_('SHE Cess on TDS'),_('Duties and Taxes'),'Ledger','Tax','Balance Sheet','1.00', 'Liability'], - # [_('Professional Tax'),_('Duties and Taxes'),'Ledger','Chargeable','Balance Sheet', None, 'Liability'], - # [_('VAT'),_('Duties and Taxes'),'Ledger','Chargeable','Balance Sheet', None, 'Liability'], - # [_('TDS (Advertisement)'),_('Duties and Taxes'),'Ledger','Chargeable','Balance Sheet', None, 'Liability'], - # [_('TDS (Commission)'),_('Duties and Taxes'),'Ledger','Chargeable','Balance Sheet', None, 'Liability'], - # [_('TDS (Contractor)'),_('Duties and Taxes'),'Ledger','Chargeable','Balance Sheet', None, 'Liability'], - # [_('TDS (Interest)'),_('Duties and Taxes'),'Ledger','Chargeable','Balance Sheet', None, 'Liability'], - # [_('TDS (Rent)'),_('Duties and Taxes'),'Ledger','Chargeable','Balance Sheet', None, 'Liability'], - # [_('TDS (Salary)'),_('Duties and Taxes'),'Ledger','Chargeable','Balance Sheet', None, 'Liability'] - # ] - # - # for lst in acc_list_india: - # account = frappe.get_doc({ - # "doctype": "Account", - # "freeze_account": "No", - # "company": company.name - # }) - # - # for d in fld_dict.keys(): - # account.set(d, (d == 'parent_account' and lst[fld_dict[d]]) and lst[fld_dict[d]] +' - '+ company.abbr or lst[fld_dict[d]]) - # - # account.insert() diff --git a/erpnext/setup/page/setup_wizard/setup_wizard.py b/erpnext/setup/page/setup_wizard/setup_wizard.py index 586ee23b4d..52b3f4b849 100644 --- a/erpnext/setup/page/setup_wizard/setup_wizard.py +++ b/erpnext/setup/page/setup_wizard/setup_wizard.py @@ -285,16 +285,19 @@ def create_taxes(args): tax_rate = (args.get("tax_rate_" + str(i)) or "").replace("%", "") try: - frappe.get_doc({ - "doctype":"Account", - "company": args.get("company_name").strip(), - "parent_account": _("Duties and Taxes") + " - " + args.get("company_abbr"), - "account_name": args.get("tax_" + str(i)), - "group_or_ledger": "Ledger", - "report_type": "Balance Sheet", - "account_type": "Tax", - "tax_rate": flt(tax_rate) if tax_rate else None - }).insert() + tax_group = frappe.db.get_value("Account", {"company": args.get("company_name"), + "group_or_ledger": "Group", "account_type": "Tax", "root_type": "Liability"}) + if tax_group: + frappe.get_doc({ + "doctype":"Account", + "company": args.get("company_name").strip(), + "parent_account": tax_group, + "account_name": args.get("tax_" + str(i)), + "group_or_ledger": "Ledger", + "report_type": "Balance Sheet", + "account_type": "Tax", + "tax_rate": flt(tax_rate) if tax_rate else None + }).insert() except frappe.NameError, e: if e.args[2][0]==1062: pass