fix(patch): Remove missed records for HR & Payroll separation (#31646)

* fix(patch): delete HR Payroll custom fields from core

* fix: delete HR Payroll dashboard chart, number card, web forms
This commit is contained in:
Rucha Mahabal 2022-07-20 18:56:37 +05:30 committed by GitHub
parent 2b0b53f587
commit 8b67d627d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 48 additions and 7 deletions

View File

@ -307,4 +307,4 @@ erpnext.patches.v14_0.migrate_gl_to_payment_ledger
erpnext.patches.v14_0.crm_ux_cleanup
erpnext.patches.v14_0.remove_india_localisation # 14-07-2022
erpnext.patches.v13_0.fix_number_and_frequency_for_monthly_depreciation
erpnext.patches.v14_0.remove_hr_and_payroll_modules
erpnext.patches.v14_0.remove_hr_and_payroll_modules # 20-07-2022

View File

@ -33,12 +33,6 @@ def execute():
]:
frappe.delete_doc("Report", report, ignore_missing=True)
dashboards = frappe.get_all(
"Dashboard", {"module": ("in", ["HR", "Payroll"]), "is_standard": 1}, pluck="name"
)
for dashboard in dashboards:
frappe.delete_doc("Dashboard", dashboard, ignore_missing=True, force=True)
doctypes = frappe.get_all(
"DocType", {"module": ("in", ["HR", "Payroll"]), "custom": 0}, pluck="name"
)
@ -53,3 +47,50 @@ def execute():
)
for notifcation in notifications:
frappe.delete_doc("Notification", notifcation, ignore_missing=True)
frappe.delete_doc("User Type", "Employee Self Service", ignore_missing=True, force=True)
for dt in ["Web Form", "Dashboard", "Dashboard Chart", "Number Card"]:
records = frappe.get_all(
dt, {"module": ("in", ["HR", "Payroll"]), "is_standard": 1}, pluck="name"
)
for record in records:
frappe.delete_doc(dt, record, ignore_missing=True, force=True)
custom_fields = {
"Salary Component": ["component_type"],
"Employee": ["ifsc_code", "pan_number", "micr_code", "provident_fund_account"],
"Company": [
"hra_section",
"basic_component",
"hra_component",
"hra_column_break",
"arrear_component",
],
"Employee Tax Exemption Declaration": [
"hra_section",
"monthly_house_rent",
"rented_in_metro_city",
"salary_structure_hra",
"hra_column_break",
"annual_hra_exemption",
"monthly_hra_exemption",
],
"Employee Tax Exemption Proof Submission": [
"hra_section",
"house_rent_payment_amount",
"rented_in_metro_city",
"rented_from_date",
"rented_to_date",
"hra_column_break",
"monthly_house_rent",
"monthly_hra_exemption",
"total_eligible_hra_exemption",
],
}
for doc, fields in custom_fields.items():
filters = {"dt": doc, "fieldname": ["in", fields]}
records = frappe.get_all("Custom Field", filters=filters, pluck="name")
for record in records:
frappe.delete_doc("Custom Field", record, ignore_missing=True, force=True)