diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 5a984635fd..892e89d653 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -374,3 +374,4 @@ erpnext.patches.v13_0.set_per_billed_in_return_delivery_note execute:frappe.delete_doc("DocType", "Naming Series") erpnext.patches.v13_0.set_payroll_entry_status erpnext.patches.v13_0.job_card_status_on_hold +erpnext.patches.v14_0.delete_hr_payroll_doctypes \ No newline at end of file diff --git a/erpnext/patches/v14_0/delete_hr_payroll_doctypes.py b/erpnext/patches/v14_0/delete_hr_payroll_doctypes.py new file mode 100644 index 0000000000..8a42a06102 --- /dev/null +++ b/erpnext/patches/v14_0/delete_hr_payroll_doctypes.py @@ -0,0 +1,43 @@ +import frappe + + +def execute(): + frappe.delete_doc("Module Def", "HR", ignore_missing=True, force=True) + frappe.delete_doc("Module Def", "Payroll", ignore_missing=True, force=True) + + frappe.delete_doc("Workspace", "HR", ignore_missing=True, force=True) + frappe.delete_doc("Workspace", "Payroll", ignore_missing=True, force=True) + + print_formats = frappe.get_all( + "Print Format", {"module": ("in", ["HR", "Payroll"]), "standard": "Yes"}, pluck="name" + ) + for print_format in print_formats: + frappe.delete_doc("Print Format", print_format, ignore_missing=True, force=True) + + reports = frappe.get_all("Report", {"module": ("in", ["HR", "Payroll"]), "is_standard": "Yes"}, pluck="name") + for report in reports: + frappe.delete_doc("Report", report, ignore_missing=True, force=True) + + # reports moved from Projects, Accounts, and Regional module to HRMS app + for report in [ + "Project Profitability", + "Employee Hours Utilization Based On Timesheet", + "Unpaid Expense Claim", + "Professional Tax Deductions", + "Provident Fund Deductions", + ]: + 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") + for doctype in doctypes: + frappe.delete_doc("DocType", doctype, ignore_missing=True) + + frappe.delete_doc("Loan Management", "Salary Slip Loan", ignore_missing=True) + + notifications = frappe.get_all("Notification", {"module": ("in", ["HR", "Payroll"]), "is_standard": 1}, pluck="name") + for notifcation in notifications: + frappe.delete_doc("Notification", notifcation, ignore_missing=True)