diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index 5fca061..ac52996 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -399,17 +399,14 @@
 	},
 	"all": [
 		"erpnext.projects.doctype.project.project.project_status_update_reminder",
-		"erpnext.hr.doctype.interview.interview.send_interview_reminder",
 		"erpnext.crm.doctype.social_media_post.social_media_post.process_scheduled_social_media_posts",
 	],
 	"hourly": [
-		"erpnext.hr.doctype.daily_work_summary_group.daily_work_summary_group.trigger_emails",
 		"erpnext.accounts.doctype.subscription.subscription.process_all",
 		"erpnext.accounts.doctype.gl_entry.gl_entry.rename_gle_sle_docs",
 		"erpnext.erpnext_integrations.doctype.plaid_settings.plaid_settings.automatic_synchronization",
 		"erpnext.projects.doctype.project.project.hourly_reminder",
 		"erpnext.projects.doctype.project.project.collect_project_status",
-		"erpnext.hr.doctype.shift_type.shift_type.process_auto_attendance_for_all_shifts",
 	],
 	"hourly_long": [
 		"erpnext.stock.doctype.repost_item_valuation.repost_item_valuation.repost_entries",
@@ -423,7 +420,6 @@
 		"erpnext.accounts.doctype.fiscal_year.fiscal_year.auto_create_fiscal_year",
 		"erpnext.projects.doctype.task.task.set_tasks_as_overdue",
 		"erpnext.assets.doctype.asset.depreciation.post_depreciation_entries",
-		"erpnext.hr.doctype.daily_work_summary_group.daily_work_summary_group.send_summary",
 		"erpnext.stock.doctype.serial_no.serial_no.update_maintenance_status",
 		"erpnext.buying.doctype.supplier_scorecard.supplier_scorecard.refresh_scorecards",
 		"erpnext.setup.doctype.company.company.cache_companies_monthly_sales_history",
@@ -439,14 +435,10 @@
 		"erpnext.selling.doctype.quotation.quotation.set_expired_status",
 		"erpnext.buying.doctype.supplier_quotation.supplier_quotation.set_expired_status",
 		"erpnext.accounts.doctype.process_statement_of_accounts.process_statement_of_accounts.send_auto_email",
-		"erpnext.hr.doctype.interview.interview.send_daily_feedback_reminder",
 	],
 	"daily_long": [
 		"erpnext.setup.doctype.email_digest.email_digest.send",
 		"erpnext.manufacturing.doctype.bom_update_tool.bom_update_tool.auto_update_latest_price_in_all_boms",
-		"erpnext.hr.doctype.leave_ledger_entry.leave_ledger_entry.process_expired_allocation",
-		"erpnext.hr.utils.generate_leave_encashment",
-		"erpnext.hr.utils.allocate_earned_leaves",
 		"erpnext.loan_management.doctype.process_loan_security_shortfall.process_loan_security_shortfall.create_process_loan_security_shortfall",
 		"erpnext.loan_management.doctype.process_loan_interest_accrual.process_loan_interest_accrual.process_loan_interest_accrual_for_term_loans",
 		"erpnext.crm.doctype.lead.lead.daily_open_lead",
@@ -535,8 +527,6 @@
 		"erpnext.controllers.taxes_and_totals.get_itemised_tax_breakup_data": "erpnext.regional.india.utils.get_itemised_tax_breakup_data",
 		"erpnext.accounts.party.get_regional_address_details": "erpnext.regional.india.utils.get_regional_address_details",
 		"erpnext.controllers.taxes_and_totals.get_regional_round_off_accounts": "erpnext.regional.india.utils.get_regional_round_off_accounts",
-		"erpnext.hr.utils.calculate_annual_eligible_hra_exemption": "erpnext.regional.india.utils.calculate_annual_eligible_hra_exemption",
-		"erpnext.hr.utils.calculate_hra_exemption_for_period": "erpnext.regional.india.utils.calculate_hra_exemption_for_period",
 		"erpnext.controllers.accounts_controller.validate_einvoice_fields": "erpnext.regional.india.e_invoice.utils.validate_einvoice_fields",
 		"erpnext.assets.doctype.asset.asset.get_depreciation_amount": "erpnext.regional.india.utils.get_depreciation_amount",
 		"erpnext.stock.doctype.item.item.set_item_tax_from_hsn_code": "erpnext.regional.india.utils.set_item_tax_from_hsn_code",
diff --git a/erpnext/regional/india/utils.py b/erpnext/regional/india/utils.py
index ee48ccb..049486e 100644
--- a/erpnext/regional/india/utils.py
+++ b/erpnext/regional/india/utils.py
@@ -1,25 +1,13 @@
 import json
-import math
 import re
 
 import frappe
 from frappe import _
 from frappe.model.utils import get_fetch_values
-from frappe.utils import (
-	add_days,
-	cint,
-	cstr,
-	date_diff,
-	flt,
-	get_link_to_form,
-	getdate,
-	month_diff,
-)
+from frappe.utils import cint, cstr, date_diff, flt, getdate
 
 from erpnext.controllers.accounts_controller import get_taxes_and_charges
 from erpnext.controllers.taxes_and_totals import get_itemised_tax, get_itemised_taxable_amount
-from erpnext.hr.utils import get_salary_assignments
-from erpnext.payroll.doctype.salary_structure.salary_structure import make_salary_slip
 from erpnext.regional.india import number_state_mapping, state_numbers, states
 
 GST_INVOICE_NUMBER_FORMAT = re.compile(r"^[a-zA-Z0-9\-/]+$")  # alphanumeric and - /
@@ -365,201 +353,6 @@
 	return default_tax
 
 
-def calculate_annual_eligible_hra_exemption(doc):
-	basic_component, hra_component = frappe.db.get_value(
-		"Company", doc.company, ["basic_component", "hra_component"]
-	)
-
-	if not (basic_component and hra_component):
-		frappe.throw(
-			_("Please set Basic and HRA component in Company {0}").format(
-				get_link_to_form("Company", doc.company)
-			)
-		)
-
-	annual_exemption = monthly_exemption = hra_amount = basic_amount = 0
-
-	if hra_component and basic_component:
-		assignments = get_salary_assignments(doc.employee, doc.payroll_period)
-
-		if not assignments and doc.docstatus == 1:
-			frappe.throw(
-				_("Salary Structure must be submitted before submission of {0}").format(doc.doctype)
-			)
-
-		assignment_dates = [assignment.from_date for assignment in assignments]
-
-		for idx, assignment in enumerate(assignments):
-			if has_hra_component(assignment.salary_structure, hra_component):
-				basic_salary_amt, hra_salary_amt = get_component_amt_from_salary_slip(
-					doc.employee,
-					assignment.salary_structure,
-					basic_component,
-					hra_component,
-					assignment.from_date,
-				)
-				to_date = get_end_date_for_assignment(assignment_dates, idx, doc.payroll_period)
-
-				frequency = frappe.get_value(
-					"Salary Structure", assignment.salary_structure, "payroll_frequency"
-				)
-				basic_amount += get_component_pay(frequency, basic_salary_amt, assignment.from_date, to_date)
-				hra_amount += get_component_pay(frequency, hra_salary_amt, assignment.from_date, to_date)
-
-		if hra_amount:
-			if doc.monthly_house_rent:
-				annual_exemption = calculate_hra_exemption(
-					assignment.salary_structure,
-					basic_amount,
-					hra_amount,
-					doc.monthly_house_rent,
-					doc.rented_in_metro_city,
-				)
-				if annual_exemption > 0:
-					monthly_exemption = annual_exemption / 12
-				else:
-					annual_exemption = 0
-
-	return frappe._dict(
-		{
-			"hra_amount": hra_amount,
-			"annual_exemption": annual_exemption,
-			"monthly_exemption": monthly_exemption,
-		}
-	)
-
-
-def has_hra_component(salary_structure, hra_component):
-	return frappe.db.exists(
-		"Salary Detail",
-		{
-			"parent": salary_structure,
-			"salary_component": hra_component,
-			"parentfield": "earnings",
-			"parenttype": "Salary Structure",
-		},
-	)
-
-
-def get_end_date_for_assignment(assignment_dates, idx, payroll_period):
-	end_date = None
-
-	try:
-		end_date = assignment_dates[idx + 1]
-		end_date = add_days(end_date, -1)
-	except IndexError:
-		pass
-
-	if not end_date:
-		end_date = frappe.db.get_value("Payroll Period", payroll_period, "end_date")
-
-	return end_date
-
-
-def get_component_amt_from_salary_slip(
-	employee, salary_structure, basic_component, hra_component, from_date
-):
-	salary_slip = make_salary_slip(
-		salary_structure,
-		employee=employee,
-		for_preview=1,
-		ignore_permissions=True,
-		posting_date=from_date,
-	)
-
-	basic_amt, hra_amt = 0, 0
-	for earning in salary_slip.earnings:
-		if earning.salary_component == basic_component:
-			basic_amt = earning.amount
-		elif earning.salary_component == hra_component:
-			hra_amt = earning.amount
-		if basic_amt and hra_amt:
-			return basic_amt, hra_amt
-	return basic_amt, hra_amt
-
-
-def calculate_hra_exemption(
-	salary_structure, annual_basic, annual_hra, monthly_house_rent, rented_in_metro_city
-):
-	# TODO make this configurable
-	exemptions = []
-	# case 1: The actual amount allotted by the employer as the HRA.
-	exemptions.append(annual_hra)
-
-	# case 2: Actual rent paid less 10% of the basic salary.
-	actual_annual_rent = monthly_house_rent * 12
-	exemptions.append(flt(actual_annual_rent) - flt(annual_basic * 0.1))
-
-	# case 3: 50% of the basic salary, if the employee is staying in a metro city (40% for a non-metro city).
-	exemptions.append(annual_basic * 0.5 if rented_in_metro_city else annual_basic * 0.4)
-
-	# return minimum of 3 cases
-	return min(exemptions)
-
-
-def get_component_pay(frequency, amount, from_date, to_date):
-	days = date_diff(to_date, from_date) + 1
-
-	if frequency == "Daily":
-		return amount * days
-	elif frequency == "Weekly":
-		return amount * math.floor(days / 7)
-	elif frequency == "Fortnightly":
-		return amount * math.floor(days / 14)
-	elif frequency == "Monthly":
-		return amount * month_diff(to_date, from_date)
-	elif frequency == "Bimonthly":
-		return amount * (month_diff(to_date, from_date) / 2)
-
-
-def validate_house_rent_dates(doc):
-	if not doc.rented_to_date or not doc.rented_from_date:
-		frappe.throw(_("House rented dates required for exemption calculation"))
-
-	if date_diff(doc.rented_to_date, doc.rented_from_date) < 14:
-		frappe.throw(_("House rented dates should be atleast 15 days apart"))
-
-	proofs = frappe.db.sql(
-		"""
-		select name
-		from `tabEmployee Tax Exemption Proof Submission`
-		where
-			docstatus=1 and employee=%(employee)s and payroll_period=%(payroll_period)s
-			and (rented_from_date between %(from_date)s and %(to_date)s or rented_to_date between %(from_date)s and %(to_date)s)
-	""",
-		{
-			"employee": doc.employee,
-			"payroll_period": doc.payroll_period,
-			"from_date": doc.rented_from_date,
-			"to_date": doc.rented_to_date,
-		},
-	)
-
-	if proofs:
-		frappe.throw(_("House rent paid days overlapping with {0}").format(proofs[0][0]))
-
-
-def calculate_hra_exemption_for_period(doc):
-	monthly_rent, eligible_hra = 0, 0
-	if doc.house_rent_payment_amount:
-		validate_house_rent_dates(doc)
-		# TODO receive rented months or validate dates are start and end of months?
-		# Calc monthly rent, round to nearest .5
-		factor = flt(date_diff(doc.rented_to_date, doc.rented_from_date) + 1) / 30
-		factor = round(factor * 2) / 2
-		monthly_rent = doc.house_rent_payment_amount / factor
-		# update field used by calculate_annual_eligible_hra_exemption
-		doc.monthly_house_rent = monthly_rent
-		exemptions = calculate_annual_eligible_hra_exemption(doc)
-
-		if exemptions["monthly_exemption"]:
-			# calc total exemption amount
-			eligible_hra = exemptions["monthly_exemption"] * factor
-		exemptions["monthly_house_rent"] = monthly_rent
-		exemptions["total_eligible_hra_exemption"] = eligible_hra
-		return exemptions
-
-
 def get_ewb_data(dt, dn):
 
 	ewaybills = []
