Merge pull request #1883 from anandpdoshi/anand-july-3

Issues originating due to sql_mode='STRICT_ALL_TABLES'
diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py
index 789a7f1..d24c7e7 100644
--- a/erpnext/setup/doctype/company/company.py
+++ b/erpnext/setup/doctype/company/company.py
@@ -123,7 +123,7 @@
 				'cost_center_name': self.name,
 				'company':self.name,
 				'group_or_ledger':'Group',
-				'parent_cost_center':''
+				'parent_cost_center':None
 			},
 			{
 				'cost_center_name':_('Main'),
@@ -190,72 +190,72 @@
 		}
 
 		acc_list_common = [
-			[_('Application of Funds (Assets)'),'','Group','','Balance Sheet','', 'Asset'],
-				[_('Current Assets'),_('Application of Funds (Assets)'),'Group','','Balance Sheet','', 'Asset'],
-					[_('Accounts Receivable'),_('Current Assets'),'Group','','Balance Sheet','', 'Asset'],
-					[_('Bank Accounts'),_('Current Assets'),'Group','Bank','Balance Sheet','', 'Asset'],
-					[_('Cash In Hand'),_('Current Assets'),'Group','Cash','Balance Sheet','', 'Asset'],
-						[_('Cash'),_('Cash In Hand'),'Ledger','Cash','Balance Sheet','', 'Asset'],
-					[_('Loans and Advances (Assets)'),_('Current Assets'),'Group','','Balance Sheet','', 'Asset'],
-					[_('Securities and Deposits'),_('Current Assets'),'Group','','Balance Sheet','', 'Asset'],
-						[_('Earnest Money'),_('Securities and Deposits'),'Ledger','','Balance Sheet','', 'Asset'],
-					[_('Stock Assets'),_('Current Assets'),'Group','Stock','Balance Sheet','', 'Asset'],
-					[_('Tax Assets'),_('Current Assets'),'Group','','Balance Sheet','', 'Asset'],
-				[_('Fixed Assets'),_('Application of Funds (Assets)'),'Group','','Balance Sheet','', 'Asset'],
-					[_('Capital Equipments'),_('Fixed Assets'),'Ledger','Fixed Asset','Balance Sheet','', 'Asset'],
-					[_('Computers'),_('Fixed Assets'),'Ledger','Fixed Asset','Balance Sheet','', 'Asset'],
-					[_('Furniture and Fixture'),_('Fixed Assets'),'Ledger','Fixed Asset','Balance Sheet','', 'Asset'],
-					[_('Office Equipments'),_('Fixed Assets'),'Ledger','Fixed Asset','Balance Sheet','', 'Asset'],
-					[_('Plant and Machinery'),_('Fixed Assets'),'Ledger','Fixed Asset','Balance Sheet','', 'Asset'],
-				[_('Investments'),_('Application of Funds (Assets)'),'Group','','Balance Sheet','', 'Asset'],
-				[_('Temporary Accounts (Assets)'),_('Application of Funds (Assets)'),'Group','','Balance Sheet','', 'Asset'],
-					[_('Temporary Assets'),_('Temporary Accounts (Assets)'),'Ledger','','Balance Sheet','', 'Asset'],
-			[_('Expenses'),'','Group','Expense Account','Profit and Loss','', 'Expense'],
-				[_('Direct Expenses'),_('Expenses'),'Group','Expense Account','Profit and Loss','', 'Expense'],
-					[_('Stock Expenses'),_('Direct Expenses'),'Group','Expense Account','Profit and Loss','', 'Expense'],
-						[_('Cost of Goods Sold'),_('Stock Expenses'),'Ledger','Expense Account','Profit and Loss','', 'Expense'],
-						[_('Stock Adjustment'),_('Stock Expenses'),'Ledger','Stock Adjustment','Profit and Loss','', 'Expense'],
-						[_('Expenses Included In Valuation'), _("Stock Expenses"), 'Ledger', 'Expenses Included In Valuation', 'Profit and Loss',  '', 'Expense'],
-				[_('Indirect Expenses'), _('Expenses'),'Group','Expense Account','Profit and Loss','', 'Expense'],
-					[_('Marketing Expenses'), _('Indirect Expenses'),'Ledger','Chargeable','Profit and Loss','', 'Expense'],
-					[_('Sales Expenses'), _('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss','', 'Expense'],
-					[_('Administrative Expenses'), _('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss','', 'Expense'],
-					[_('Charity and Donations'), _('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss','', 'Expense'],
-					[_('Commission on Sales'), _('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss','', 'Expense'],
-					[_('Travel Expenses'), _('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss','', 'Expense'],
-					[_('Entertainment Expenses'), _('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss','', 'Expense'],
-					[_('Depreciation'), _('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss','', 'Expense'],
-					[_('Freight and Forwarding Charges'), _('Indirect Expenses'),'Ledger','Chargeable','Profit and Loss','', 'Expense'],
-					[_('Legal Expenses'), _('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss','', 'Expense'],
-					[_('Miscellaneous Expenses'), _('Indirect Expenses'),'Ledger','Chargeable','Profit and Loss','', 'Expense'],
-					[_('Office Maintenance Expenses'), _('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss','', 'Expense'],
-					[_('Office Rent'), _('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss','', 'Expense'],
-					[_('Postal Expenses'), _('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss','', 'Expense'],
-					[_('Print and Stationary'), _('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss','', 'Expense'],
-					[_('Rounded Off'), _('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss','', 'Expense'],
-					[_('Salary') ,_('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss','', 'Expense'],
-					[_('Telephone Expenses') ,_('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss','', 'Expense'],
-					[_('Utility Expenses') ,_('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss','', 'Expense'],
-			[_('Income'),'','Group','','Profit and Loss','', 'Income'],
-				[_('Direct Income'),_('Income'),'Group','Income Account','Profit and Loss','', 'Income'],
-					[_('Sales'),_('Direct Income'),'Ledger','Income Account','Profit and Loss','', 'Income'],
-					[_('Service'),_('Direct Income'),'Ledger','Income Account','Profit and Loss','', 'Income'],
-				[_('Indirect Income'),_('Income'),'Group','Income Account','Profit and Loss','', 'Income'],
-			[_('Source of Funds (Liabilities)'),'','Group','','Balance Sheet','', 'Income'],
-				[_('Capital Account'),_('Source of Funds (Liabilities)'),'Group','','Balance Sheet','', 'Liability'],
-					[_('Reserves and Surplus'),_('Capital Account'),'Ledger','','Balance Sheet','', 'Liability'],
-					[_('Shareholders Funds'),_('Capital Account'),'Ledger','','Balance Sheet','', 'Liability'],
-				[_('Current Liabilities'),_('Source of Funds (Liabilities)'),'Group','','Balance Sheet','', 'Liability'],
-					[_('Accounts Payable'),_('Current Liabilities'),'Group','','Balance Sheet','', 'Liability'],
-					[_('Stock Liabilities'),_('Current Liabilities'),'Group','','Balance Sheet','', 'Liability'],
-						[_('Stock Received But Not Billed'), _('Stock Liabilities'), 'Ledger', 'Stock Received But Not Billed', 'Balance Sheet',  '', 'Liability'],
-					[_('Duties and Taxes'),_('Current Liabilities'),'Group','','Balance Sheet','', 'Liability'],
-					[_('Loans (Liabilities)'),_('Current Liabilities'),'Group','','Balance Sheet','', 'Liability'],
-						[_('Secured Loans'),_('Loans (Liabilities)'),'Group','','Balance Sheet','', 'Liability'],
-						[_('Unsecured Loans'),_('Loans (Liabilities)'),'Group','','Balance Sheet','', 'Liability'],
-						[_('Bank Overdraft Account'),_('Loans (Liabilities)'),'Group','','Balance Sheet','', 'Liability'],
-				[_('Temporary Accounts (Liabilities)'),_('Source of Funds (Liabilities)'),'Group','','Balance Sheet','', 'Liability'],
-					[_('Temporary Liabilities'),_('Temporary Accounts (Liabilities)'),'Ledger','','Balance Sheet','', 'Liability']
+			[_('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'],
+					[_('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, 'Income'],
+				[_('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'],
+					[_('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
diff --git a/erpnext/setup/doctype/company/fixtures/india/__init__.py b/erpnext/setup/doctype/company/fixtures/india/__init__.py
index 0f427f5..fa45ab0 100644
--- a/erpnext/setup/doctype/company/fixtures/india/__init__.py
+++ b/erpnext/setup/doctype/company/fixtures/india/__init__.py
@@ -31,21 +31,21 @@
 	}
 
 	acc_list_india = [
-		['CENVAT Capital Goods','Tax Assets','Ledger','Chargeable','Balance Sheet',''],
-		['CENVAT','Tax Assets','Ledger','Chargeable','Balance Sheet',''],
-		['CENVAT Service Tax','Tax Assets','Ledger','Chargeable','Balance Sheet',''],
-		['CENVAT Service Tax Cess 1','Tax Assets','Ledger','Chargeable','Balance Sheet',''],
-		['CENVAT Service Tax Cess 2','Tax Assets','Ledger','Chargeable','Balance Sheet',''],
-		['CENVAT Edu Cess','Tax Assets','Ledger','Chargeable','Balance Sheet',''],
-		['CENVAT SHE Cess','Tax Assets','Ledger','Chargeable','Balance Sheet',''],
+		['CENVAT Capital Goods','Tax Assets','Ledger','Chargeable','Balance Sheet', None],
+		['CENVAT','Tax Assets','Ledger','Chargeable','Balance Sheet', None],
+		['CENVAT Service Tax','Tax Assets','Ledger','Chargeable','Balance Sheet', None],
+		['CENVAT Service Tax Cess 1','Tax Assets','Ledger','Chargeable','Balance Sheet', None],
+		['CENVAT Service Tax Cess 2','Tax Assets','Ledger','Chargeable','Balance Sheet', None],
+		['CENVAT Edu Cess','Tax Assets','Ledger','Chargeable','Balance Sheet', None],
+		['CENVAT SHE Cess','Tax Assets','Ledger','Chargeable','Balance Sheet', None],
 		['Excise Duty 4','Tax Assets','Ledger','Tax','Balance Sheet','4.00'],
 		['Excise Duty 8','Tax Assets','Ledger','Tax','Balance Sheet','8.00'],
 		['Excise Duty 10','Tax Assets','Ledger','Tax','Balance Sheet','10.00'],
 		['Excise Duty 14','Tax Assets','Ledger','Tax','Balance Sheet','14.00'],
 		['Excise Duty Edu Cess 2','Tax Assets','Ledger','Tax','Balance Sheet','2.00'],
 		['Excise Duty SHE Cess 1','Tax Assets','Ledger','Tax','Balance Sheet','1.00'],
-		['P L A','Tax Assets','Ledger','Chargeable','Balance Sheet',''],
-		['P L A - Cess Portion','Tax Assets','Ledger','Chargeable','Balance Sheet',''],
+		['P L A','Tax Assets','Ledger','Chargeable','Balance Sheet', None],
+		['P L A - Cess Portion','Tax Assets','Ledger','Chargeable','Balance Sheet', None],
 		['Edu. Cess on Excise','Duties and Taxes','Ledger','Tax','Balance Sheet','2.00'],
 		['Edu. Cess on Service Tax','Duties and Taxes','Ledger','Tax','Balance Sheet','2.00'],
 		['Edu. Cess on TDS','Duties and Taxes','Ledger','Tax','Balance Sheet','2.00'],
@@ -57,14 +57,14 @@
 		['SHE Cess on Excise','Duties and Taxes','Ledger','Tax','Balance Sheet','1.00'],
 		['SHE Cess on Service Tax','Duties and Taxes','Ledger','Tax','Balance Sheet','1.00'],
 		['SHE Cess on TDS','Duties and Taxes','Ledger','Tax','Balance Sheet','1.00'],
-		['Professional Tax','Duties and Taxes','Ledger','Chargeable','Balance Sheet',''],
-		['VAT','Duties and Taxes','Ledger','Chargeable','Balance Sheet',''],
-		['TDS (Advertisement)','Duties and Taxes','Ledger','Chargeable','Balance Sheet',''],
-		['TDS (Commission)','Duties and Taxes','Ledger','Chargeable','Balance Sheet',''],
-		['TDS (Contractor)','Duties and Taxes','Ledger','Chargeable','Balance Sheet',''],
-		['TDS (Interest)','Duties and Taxes','Ledger','Chargeable','Balance Sheet',''],
-		['TDS (Rent)','Duties and Taxes','Ledger','Chargeable','Balance Sheet',''],
-		['TDS (Salary)','Duties and Taxes','Ledger','Chargeable','Balance Sheet','']
+		['Professional Tax','Duties and Taxes','Ledger','Chargeable','Balance Sheet', None],
+		['VAT','Duties and Taxes','Ledger','Chargeable','Balance Sheet', None],
+		['TDS (Advertisement)','Duties and Taxes','Ledger','Chargeable','Balance Sheet', None],
+		['TDS (Commission)','Duties and Taxes','Ledger','Chargeable','Balance Sheet', None],
+		['TDS (Contractor)','Duties and Taxes','Ledger','Chargeable','Balance Sheet', None],
+		['TDS (Interest)','Duties and Taxes','Ledger','Chargeable','Balance Sheet', None],
+		['TDS (Rent)','Duties and Taxes','Ledger','Chargeable','Balance Sheet', None],
+		['TDS (Salary)','Duties and Taxes','Ledger','Chargeable','Balance Sheet', None]
 	 ]
 
 	for lst in acc_list_india: