From b93ebaebe414ab4705ab31ef1d7fc6a77d28618c Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 7 Mar 2014 17:06:02 +0530 Subject: [PATCH] Added new account types and patch for existing --- erpnext/accounts/doctype/account/account.txt | 6 +++--- .../accounts/doctype/sales_invoice/sales_invoice.py | 6 +++--- .../accounts/page/accounts_browser/accounts_browser.js | 2 +- erpnext/patches.txt | 1 + erpnext/patches/4_0/countrywise_coa.py | 9 +++++++++ erpnext/setup/doctype/company/company.py | 10 +++++----- 6 files changed, 22 insertions(+), 12 deletions(-) create mode 100644 erpnext/patches/4_0/countrywise_coa.py diff --git a/erpnext/accounts/doctype/account/account.txt b/erpnext/accounts/doctype/account/account.txt index 62d5934c36..7c31998d17 100644 --- a/erpnext/accounts/doctype/account/account.txt +++ b/erpnext/accounts/doctype/account/account.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-30 12:49:46", "docstatus": 0, - "modified": "2014-03-03 18:43:33", + "modified": "2014-03-07 16:26:42", "modified_by": "Administrator", "owner": "Administrator" }, @@ -140,7 +140,7 @@ "fieldname": "root_type", "fieldtype": "Select", "label": "Root Type", - "options": "\nAsset\nLiability\nExpense\nIncome\nEquity" + "options": "\nAsset\nLiability\nExpense\nIncome" }, { "description": "Setting Account Type helps in selecting this Account in transactions.", @@ -151,7 +151,7 @@ "label": "Account Type", "oldfieldname": "account_type", "oldfieldtype": "Select", - "options": "\nFixed Asset Account\nBank or Cash\nExpense Account\nTax\nIncome Account\nChargeable\nWarehouse", + "options": "Bank or Cash\nTax\nChargeable\nWarehouse\nReceivable\nPayable\nEquity\nFixed Asset\nCost of Goods Sold\nExpense Account\nIncome Account", "search_index": 0 }, { diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 0a145b5dd0..12334fab2b 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -261,7 +261,7 @@ class DocType(SellingController): frappe.throw(_("Account must be an asset account")) def validate_fixed_asset_account(self): - """Validate Fixed Asset Account and whether Income Account Entered Exists""" + """Validate Fixed Asset and whether Income Account Entered Exists""" for d in getlist(self.doclist,'entries'): item = frappe.db.sql("""select name,is_asset_item,is_sales_item from `tabItem` where name = %s and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' @@ -270,8 +270,8 @@ class DocType(SellingController): where name = %s and docstatus != 2""", d.income_account) if not acc: msgprint("Account: "+d.income_account+" does not exist in the system", raise_exception=True) - elif item and item[0][1] == 'Yes' and not acc[0][0] == 'Fixed Asset Account': - msgprint("Please select income head with account type 'Fixed Asset Account' as Item %s is an asset item" % d.item_code, raise_exception=True) + elif item and item[0][1] == 'Yes' and not acc[0][0] == 'Fixed Asset': + msgprint("Please select income head with account type 'Fixed Asset' as Item %s is an asset item" % d.item_code, raise_exception=True) def validate_with_previous_doc(self): super(DocType, self).validate_with_previous_doc(self.tname, { diff --git a/erpnext/accounts/page/accounts_browser/accounts_browser.js b/erpnext/accounts/page/accounts_browser/accounts_browser.js index 50345d71ca..a842006ebd 100644 --- a/erpnext/accounts/page/accounts_browser/accounts_browser.js +++ b/erpnext/accounts/page/accounts_browser/accounts_browser.js @@ -193,7 +193,7 @@ erpnext.AccountsChart = Class.extend({ options:'Group\nLedger', description: frappe._('Further accounts can be made under Groups,')+ frappe._('but entries can be made against Ledger')}, {fieldtype:'Select', fieldname:'account_type', label:frappe._('Account Type'), - options: ['', 'Fixed Asset Account', 'Bank or Cash', 'Expense Account', 'Tax', + options: ['', 'Fixed Asset', 'Bank or Cash', 'Expense Account', 'Tax', 'Income Account', 'Chargeable'].join('\n'), description: frappe._("Optional. This setting will be used to filter in various transactions.") }, {fieldtype:'Float', fieldname:'tax_rate', label:frappe._('Tax Rate')}, diff --git a/erpnext/patches.txt b/erpnext/patches.txt index f651ea4952..a9ae54877f 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -30,3 +30,4 @@ erpnext.patches.4_0.split_email_settings erpnext.patches.4_0.fix_employee_user_id erpnext.patches.4_0.set_account_details erpnext.patches.4_0.import_country_codes +execute:patches.4_0.countrywise_coa diff --git a/erpnext/patches/4_0/countrywise_coa.py b/erpnext/patches/4_0/countrywise_coa.py new file mode 100644 index 0000000000..f2e0acf9d9 --- /dev/null +++ b/erpnext/patches/4_0/countrywise_coa.py @@ -0,0 +1,9 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe + +def execute(): + frappe.db.sql("""update tabAccount set account_type='Fixed Asset' + where account_type='Fixed Asset Account'""") \ No newline at end of file diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py index 7ceff79dc4..eefe111f97 100644 --- a/erpnext/setup/doctype/company/company.py +++ b/erpnext/setup/doctype/company/company.py @@ -227,11 +227,11 @@ class DocType: ['Stock Assets','Current Assets','Group','No','','Asset',self.doc.name,''], ['Tax Assets','Current Assets','Group','No','','Asset',self.doc.name,''], ['Fixed Assets','Application of Funds (Assets)','Group','No','','Asset',self.doc.name,''], - ['Capital Equipments','Fixed Assets','Ledger','No','Fixed Asset Account','Asset',self.doc.name,''], - ['Computers','Fixed Assets','Ledger','No','Fixed Asset Account','Asset',self.doc.name,''], - ['Furniture and Fixture','Fixed Assets','Ledger','No','Fixed Asset Account','Asset',self.doc.name,''], - ['Office Equipments','Fixed Assets','Ledger','No','Fixed Asset Account','Asset',self.doc.name,''], - ['Plant and Machinery','Fixed Assets','Ledger','No','Fixed Asset Account','Asset',self.doc.name,''], + ['Capital Equipments','Fixed Assets','Ledger','No','Fixed Asset','Asset',self.doc.name,''], + ['Computers','Fixed Assets','Ledger','No','Fixed Asset','Asset',self.doc.name,''], + ['Furniture and Fixture','Fixed Assets','Ledger','No','Fixed Asset','Asset',self.doc.name,''], + ['Office Equipments','Fixed Assets','Ledger','No','Fixed Asset','Asset',self.doc.name,''], + ['Plant and Machinery','Fixed Assets','Ledger','No','Fixed Asset','Asset',self.doc.name,''], ['Investments','Application of Funds (Assets)','Group','No','','Asset',self.doc.name,''], ['Temporary Accounts (Assets)','Application of Funds (Assets)','Group','No','','Asset',self.doc.name,''], ['Temporary Account (Assets)','Temporary Accounts (Assets)','Ledger','No','','Asset',self.doc.name,''],