fix: Add accounts and templates for reverse charge
diff --git a/erpnext/accounts/doctype/account/account.py b/erpnext/accounts/doctype/account/account.py
index 645f49b..1be2fbf 100644
--- a/erpnext/accounts/doctype/account/account.py
+++ b/erpnext/accounts/doctype/account/account.py
@@ -28,12 +28,6 @@
 		from erpnext.accounts.utils import get_autoname_with_number
 		self.name = get_autoname_with_number(self.account_number, self.account_name, None, self.company)
 
-	def before_insert(self):
-		# Update Bank account name if conflicting with any other account
-		if frappe.flags.in_install and self.account_type == 'Bank':
-			if frappe.db.get_value('Account', {'account_name': self.account_name}):
-				self.account_name = self.account_name + '-1'
-
 	def validate(self):
 		from erpnext.accounts.utils import validate_field_number
 		if frappe.local.flags.allow_unverified_charts:
diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py
index a8e4b15..1cdbd8d 100644
--- a/erpnext/accounts/utils.py
+++ b/erpnext/accounts/utils.py
@@ -788,7 +788,7 @@
 	return acc
 
 def create_payment_gateway_account(gateway, payment_channel="Email"):
-	from erpnext.setup.setup_wizard.operations.company_setup import create_bank_account
+	from erpnext.setup.setup_wizard.operations.install_fixtures import create_bank_account
 
 	company = frappe.db.get_value("Global Defaults", None, "default_company")
 	if not company:
diff --git a/erpnext/regional/india/setup.py b/erpnext/regional/india/setup.py
index 8ccbc54..39705f6 100644
--- a/erpnext/regional/india/setup.py
+++ b/erpnext/regional/india/setup.py
@@ -704,6 +704,7 @@
 	# Will only add default GST accounts if present
 	input_account_names = ['Input Tax CGST', 'Input Tax SGST', 'Input Tax IGST']
 	output_account_names = ['Output Tax CGST', 'Output Tax SGST', 'Output Tax IGST']
+	rcm_accounts = ['Input Tax CGST RCM', 'Input Tax SGST RCM', 'Input Tax IGST RCM']
 	gst_settings = frappe.get_single('GST Settings')
 	existing_account_list = []
 
@@ -712,45 +713,40 @@
 			existing_account_list.append(account.get(key))
 
 	gst_accounts = frappe._dict(frappe.get_all("Account",
-		{'company': company, 'name': ('like', "%GST%")}, ['account_name', 'name'], as_list=1))
+		{'company': company, 'account_name': ('in', input_account_names +
+			output_account_names + rcm_accounts)}, ['account_name', 'name'], as_list=1))
 
-	all_input_account_exists = 0
-	all_output_account_exists = 0
-
-	for account in input_account_names:
-		if not gst_accounts.get(account):
-			all_input_account_exists = 1
-
-		# Check if already added in GST Settings
-		if gst_accounts.get(account) in existing_account_list:
-			all_input_account_exists = 1
-
-	for account in output_account_names:
-		if not gst_accounts.get(account):
-			all_output_account_exists = 1
-
-		# Check if already added in GST Settings
-		if gst_accounts.get(account) in existing_account_list:
-			all_output_account_exists = 1
-
-	if not all_input_account_exists:
-		gst_settings.append('gst_accounts', {
-			'company': company,
-			'cgst_account': gst_accounts.get(input_account_names[0]),
-			'sgst_account': gst_accounts.get(input_account_names[1]),
-			'igst_account': gst_accounts.get(input_account_names[2])
-		})
-
-	if not all_output_account_exists:
-		gst_settings.append('gst_accounts', {
-			'company': company,
-			'cgst_account': gst_accounts.get(output_account_names[0]),
-			'sgst_account': gst_accounts.get(output_account_names[1]),
-			'igst_account': gst_accounts.get(output_account_names[2])
-		})
+	add_accounts_in_gst_settings(company,  input_account_names, gst_accounts,
+		existing_account_list, gst_settings)
+	add_accounts_in_gst_settings(company, output_account_names, gst_accounts,
+		existing_account_list, gst_settings)
+	add_accounts_in_gst_settings(company, rcm_accounts, gst_accounts,
+		existing_account_list, gst_settings, is_reverse_charge=1)
 
 	gst_settings.save()
 
+def add_accounts_in_gst_settings(company, account_names, gst_accounts,
+	existing_account_list, gst_settings, is_reverse_charge=0):
+	accounts_not_added = 1
+
+	for account in account_names:
+		# Default Account Added does not exists
+		if not gst_accounts.get(account):
+			accounts_not_added = 0
+
+		# Check if already added in GST Settings
+		if gst_accounts.get(account) in existing_account_list:
+			accounts_not_added = 0
+
+	if accounts_not_added:
+		gst_settings.append('gst_accounts', {
+			'company': company,
+			'cgst_account': gst_accounts.get(account_names[0]),
+			'sgst_account': gst_accounts.get(account_names[1]),
+			'igst_account': gst_accounts.get(account_names[2]),
+			'is_reverse_charge_account': is_reverse_charge
+		})
+
 def set_salary_components(docs):
 	docs.extend([
 		{'doctype': 'Salary Component', 'salary_component': 'Professional Tax',
@@ -803,7 +799,7 @@
 					doc.append("rates", d.get('rates')[0])
 
 			doc.flags.ignore_permissions = True
-			doc.flags.ignore_validdate = True
+			doc.flags.ignore_validate = True
 			doc.flags.ignore_mandatory = True
 			doc.flags.ignore_links = True
 			doc.save()
diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py
index 36a7d20..0b64f0d 100644
--- a/erpnext/setup/doctype/company/company.py
+++ b/erpnext/setup/doctype/company/company.py
@@ -110,8 +110,8 @@
 				self.create_default_warehouses()
 
 		if frappe.flags.country_change:
-			install_country_fixtures(self.name, self.country)
 			self.create_default_tax_template()
+			install_country_fixtures(self.name, self.country)
 
 		if not frappe.db.get_value("Department", {"company": self.name}):
 			from erpnext.setup.setup_wizard.operations.install_fixtures import install_post_company_fixtures
diff --git a/erpnext/setup/setup_wizard/data/country_wise_tax.json b/erpnext/setup/setup_wizard/data/country_wise_tax.json
index 7a61538..6df57f1 100644
--- a/erpnext/setup/setup_wizard/data/country_wise_tax.json
+++ b/erpnext/setup/setup_wizard/data/country_wise_tax.json
@@ -1178,7 +1178,12 @@
 						"gst_state": ""
 					},
 					{
-						"title": "Reverse Charge",
+						"title": "Reverse Charge In-State",
+						"is_inter_state": 0,
+						"gst_state": ""
+					},
+					{
+						"title": "Reverse Charge Out-State",
 						"is_inter_state": 0,
 						"gst_state": ""
 					},
@@ -1227,6 +1232,24 @@
 									"account_name": "Input Tax IGST",
 									"tax_rate": 18.00
 								}
+							},
+							{
+								"tax_type": {
+									"account_name": "Input Tax SGST RCM",
+									"tax_rate": 9.00
+								}
+							},
+							{
+								"tax_type": {
+									"account_name": "Input Tax CGST RCM",
+									"tax_rate": 9.00
+								}
+							},
+							{
+								"tax_type": {
+									"account_name": "Input Tax IGST RCM",
+									"tax_rate": 18.00
+								}
 							}
 						]
 					},
@@ -1268,6 +1291,24 @@
 									"account_name": "Input Tax IGST",
 									"tax_rate": 5.0
 								}
+							},
+							{
+								"tax_type": {
+									"account_name": "Input Tax SGST RCM",
+									"tax_rate": 2.50
+								}
+							},
+							{
+								"tax_type": {
+									"account_name": "Input Tax CGST RCM",
+									"tax_rate": 2.50
+								}
+							},
+							{
+								"tax_type": {
+									"account_name": "Input Tax IGST RCM",
+									"tax_rate": 5.00
+								}
 							}
 						]
 					},
@@ -1309,6 +1350,24 @@
 									"account_name": "Input Tax IGST",
 									"tax_rate": 12.0
 								}
+							},
+							{
+								"tax_type": {
+									"account_name": "Input Tax SGST RCM",
+									"tax_rate": 6.00
+								}
+							},
+							{
+								"tax_type": {
+									"account_name": "Input Tax CGST RCM",
+									"tax_rate": 6.00
+								}
+							},
+							{
+								"tax_type": {
+									"account_name": "Input Tax IGST RCM",
+									"tax_rate": 12.00
+								}
 							}
 						]
 					},
@@ -1350,6 +1409,24 @@
 									"account_name": "Input Tax IGST",
 									"tax_rate": 28.0
 								}
+							},
+							{
+								"tax_type": {
+									"account_name": "Input Tax SGST RCM",
+									"tax_rate": 14.00
+								}
+							},
+							{
+								"tax_type": {
+									"account_name": "Input Tax CGST RCM",
+									"tax_rate": 14.00
+								}
+							},
+							{
+								"tax_type": {
+									"account_name": "Input Tax IGST RCM",
+									"tax_rate": 28.00
+								}
 							}
 						]
 					},
@@ -1458,6 +1535,42 @@
 							}
 						],
 						"tax_category": "Out-State"
+					},
+					{
+						"title": "Input GST RCM In-state",
+						"taxes": [
+							{
+								"account_head": {
+									"account_name": "Input Tax SGST RCM",
+									"tax_rate": 9.00,
+									"root_type": "Asset",
+									"account_type": "Tax"
+								}
+							},
+							{
+								"account_head": {
+									"account_name": "Input Tax CGST RCM",
+									"tax_rate": 9.00,
+									"root_type": "Asset",
+									"account_type": "Tax"
+								}
+							}
+						],
+						"tax_category": "Reverse Charge In-State"
+					},
+					{
+						"title": "Input GST RCM Out-state",
+						"taxes": [
+							{
+								"account_head": {
+									"account_name": "Input Tax IGST RCM",
+									"tax_rate": 18.00,
+									"root_type": "Asset",
+									"account_type": "Tax"
+								}
+							}
+						],
+						"tax_category": "Reverse Charge Out-State"
 					}
 				],
 				"*": [
diff --git a/erpnext/setup/setup_wizard/operations/company_setup.py b/erpnext/setup/setup_wizard/operations/company_setup.py
index 3f0bb14..4edf948 100644
--- a/erpnext/setup/setup_wizard/operations/company_setup.py
+++ b/erpnext/setup/setup_wizard/operations/company_setup.py
@@ -42,29 +42,6 @@
 		'quotation_series': "QTN-",
 	}).insert()
 
-def create_bank_account(args):
-	if args.get("bank_account"):
-		company_name = args.get('company_name')
-		bank_account_group =  frappe.db.get_value("Account",
-			{"account_type": "Bank", "is_group": 1, "root_type": "Asset",
-				"company": company_name})
-		if bank_account_group:
-			bank_account = frappe.get_doc({
-				"doctype": "Account",
-				'account_name': args.get("bank_account"),
-				'parent_account': bank_account_group,
-				'is_group':0,
-				'company': company_name,
-				"account_type": "Bank",
-			})
-			try:
-				return bank_account.insert()
-			except RootNotEditable:
-				frappe.throw(_("Bank account cannot be named as {0}").format(args.get("bank_account")))
-			except frappe.DuplicateEntryError:
-				# bank account same as a CoA entry
-				pass
-
 def create_email_digest():
 	from frappe.utils.user import get_system_managers
 	system_managers = get_system_managers(only_name=True)