chore: Remove HR/Payroll related setups and fixtures

- Fixtures moved to HRMS app

- 'HR' field in Terms and Conditions removed, added via HRMS setup
This commit is contained in:
Rucha Mahabal 2022-06-17 16:34:13 +05:30
parent 4b3fb83850
commit fbc1330ab0
7 changed files with 2 additions and 344 deletions

View File

@ -389,8 +389,6 @@ auto_cancel_exempted_doctypes = [
"Payment Entry",
]
after_migrate = ["erpnext.setup.install.update_select_perm_after_install"]
scheduler_events = {
"cron": {
"0/30 * * * *": [

View File

@ -87,17 +87,6 @@ $.extend(erpnext, {
route_to_pending_reposts: (args) => {
frappe.set_route('List', 'Repost Item Valuation', args);
},
proceed_save_with_reminders_frequency_change: () => {
frappe.ui.hide_open_dialog();
frappe.call({
method: 'erpnext.hr.doctype.hr_settings.hr_settings.set_proceed_with_frequency_change',
callback: () => {
cur_frm.save();
}
});
}
});

View File

@ -775,7 +775,7 @@
"idx": 24,
"image_field": "image",
"links": [],
"modified": "2022-06-10 12:28:55.811983",
"modified": "2022-06-10 22:28:55.811983",
"modified_by": "Administrator",
"module": "Setup",
"name": "Employee",
@ -820,7 +820,6 @@
],
"search_fields": "employee_name",
"show_name_in_global_search": 1,
"show_title_field_in_link": 1,
"sort_field": "modified",
"sort_order": "DESC",
"states": [],

View File

@ -14,7 +14,6 @@
"applicable_modules_section",
"selling",
"buying",
"hr",
"section_break_7",
"terms",
"terms_and_conditions_help"
@ -69,12 +68,6 @@
"fieldtype": "Check",
"label": "Buying"
},
{
"default": "1",
"fieldname": "hr",
"fieldtype": "Check",
"label": "HR"
},
{
"fieldname": "section_break_7",
"fieldtype": "Section Break"
@ -83,7 +76,7 @@
"icon": "icon-legal",
"idx": 1,
"links": [],
"modified": "2020-06-16 22:54:38.094844",
"modified": "2022-06-16 15:07:38.094844",
"modified_by": "Administrator",
"module": "Setup",
"name": "Terms and Conditions",

View File

@ -6,7 +6,6 @@ import frappe
from frappe import _
from frappe.custom.doctype.custom_field.custom_field import create_custom_field
from frappe.desk.page.setup_wizard.setup_wizard import add_all_roles_to
from frappe.installer import update_site_config
from frappe.utils import cint
from erpnext.accounts.doctype.cash_flow_mapper.default_cash_flow_mapper import DEFAULT_MAPPERS
@ -29,7 +28,6 @@ def after_install():
add_company_to_session_defaults()
add_standard_navbar_items()
add_app_name()
add_non_standard_user_types()
frappe.db.commit()
@ -44,7 +42,6 @@ def set_single_defaults():
for dt in (
"Accounts Settings",
"Print Settings",
"HR Settings",
"Buying Settings",
"Selling Settings",
"Stock Settings",
@ -201,104 +198,3 @@ def add_standard_navbar_items():
def add_app_name():
frappe.db.set_value("System Settings", None, "app_name", "ERPNext")
def add_non_standard_user_types():
user_types = get_user_types_data()
user_type_limit = {}
for user_type, data in user_types.items():
user_type_limit.setdefault(frappe.scrub(user_type), 20)
update_site_config("user_type_doctype_limit", user_type_limit)
for user_type, data in user_types.items():
create_custom_role(data)
create_user_type(user_type, data)
def get_user_types_data():
return {
"Employee Self Service": {
"role": "Employee Self Service",
"apply_user_permission_on": "Employee",
"user_id_field": "user_id",
"doctypes": {
# masters
"Holiday List": ["read"],
"Employee": ["read", "write"],
# payroll
"Salary Slip": ["read"],
"Employee Benefit Application": ["read", "write", "create", "delete"],
# expenses
"Expense Claim": ["read", "write", "create", "delete"],
"Employee Advance": ["read", "write", "create", "delete"],
# leave and attendance
"Leave Application": ["read", "write", "create", "delete"],
"Attendance Request": ["read", "write", "create", "delete"],
"Compensatory Leave Request": ["read", "write", "create", "delete"],
# tax
"Employee Tax Exemption Declaration": ["read", "write", "create", "delete"],
"Employee Tax Exemption Proof Submission": ["read", "write", "create", "delete"],
# projects
"Timesheet": ["read", "write", "create", "delete", "submit", "cancel", "amend"],
# trainings
"Training Program": ["read"],
"Training Feedback": ["read", "write", "create", "delete", "submit", "cancel", "amend"],
# shifts
"Shift Request": ["read", "write", "create", "delete", "submit", "cancel", "amend"],
# misc
"Employee Grievance": ["read", "write", "create", "delete"],
"Employee Referral": ["read", "write", "create", "delete"],
"Travel Request": ["read", "write", "create", "delete"],
},
}
}
def create_custom_role(data):
if data.get("role") and not frappe.db.exists("Role", data.get("role")):
frappe.get_doc(
{"doctype": "Role", "role_name": data.get("role"), "desk_access": 1, "is_custom": 1}
).insert(ignore_permissions=True)
def create_user_type(user_type, data):
if frappe.db.exists("User Type", user_type):
doc = frappe.get_cached_doc("User Type", user_type)
doc.user_doctypes = []
else:
doc = frappe.new_doc("User Type")
doc.update(
{
"name": user_type,
"role": data.get("role"),
"user_id_field": data.get("user_id_field"),
"apply_user_permission_on": data.get("apply_user_permission_on"),
}
)
create_role_permissions_for_doctype(doc, data)
doc.save(ignore_permissions=True)
def create_role_permissions_for_doctype(doc, data):
for doctype, perms in data.get("doctypes").items():
args = {"document_type": doctype}
for perm in perms:
args[perm] = 1
doc.append("user_doctypes", args)
def update_select_perm_after_install():
if not frappe.flags.update_select_perm_after_migrate:
return
frappe.flags.ignore_select_perm = False
for row in frappe.get_all("User Type", filters={"is_standard": 0}):
print("Updating user type :- ", row.name)
doc = frappe.get_doc("User Type", row.name)
doc.save()
frappe.flags.update_select_perm_after_migrate = False

View File

@ -59,21 +59,6 @@ def set_default_settings(args):
delivery_settings.dispatch_template = _("Dispatch Notification")
delivery_settings.save()
hr_settings = frappe.get_doc("HR Settings")
hr_settings.emp_created_by = "Naming Series"
hr_settings.leave_approval_notification_template = _("Leave Approval Notification")
hr_settings.leave_status_notification_template = _("Leave Status Notification")
hr_settings.send_interview_reminder = 1
hr_settings.interview_reminder_template = _("Interview Reminder")
hr_settings.remind_before = "00:15:00"
hr_settings.send_interview_feedback_reminder = 1
hr_settings.feedback_reminder_notification_template = _("Interview Feedback Reminder")
hr_settings.exit_questionnaire_notification_template = _("Exit Questionnaire Notification")
hr_settings.save()
def set_no_copy_fields_in_variant_settings():
# set no copy fields of an item doctype to item variant settings

View File

@ -83,91 +83,6 @@ def install(country=None):
"is_group": 0,
"parent_item_group": _("All Item Groups"),
},
# salary component
{
"doctype": "Salary Component",
"salary_component": _("Income Tax"),
"description": _("Income Tax"),
"type": "Deduction",
"is_income_tax_component": 1,
},
{
"doctype": "Salary Component",
"salary_component": _("Basic"),
"description": _("Basic"),
"type": "Earning",
},
{
"doctype": "Salary Component",
"salary_component": _("Arrear"),
"description": _("Arrear"),
"type": "Earning",
},
{
"doctype": "Salary Component",
"salary_component": _("Leave Encashment"),
"description": _("Leave Encashment"),
"type": "Earning",
},
# expense claim type
{"doctype": "Expense Claim Type", "name": _("Calls"), "expense_type": _("Calls")},
{"doctype": "Expense Claim Type", "name": _("Food"), "expense_type": _("Food")},
{"doctype": "Expense Claim Type", "name": _("Medical"), "expense_type": _("Medical")},
{"doctype": "Expense Claim Type", "name": _("Others"), "expense_type": _("Others")},
{"doctype": "Expense Claim Type", "name": _("Travel"), "expense_type": _("Travel")},
# leave type
{
"doctype": "Leave Type",
"leave_type_name": _("Casual Leave"),
"name": _("Casual Leave"),
"allow_encashment": 1,
"is_carry_forward": 1,
"max_continuous_days_allowed": "3",
"include_holiday": 1,
},
{
"doctype": "Leave Type",
"leave_type_name": _("Compensatory Off"),
"name": _("Compensatory Off"),
"allow_encashment": 0,
"is_carry_forward": 0,
"include_holiday": 1,
"is_compensatory": 1,
},
{
"doctype": "Leave Type",
"leave_type_name": _("Sick Leave"),
"name": _("Sick Leave"),
"allow_encashment": 0,
"is_carry_forward": 0,
"include_holiday": 1,
},
{
"doctype": "Leave Type",
"leave_type_name": _("Privilege Leave"),
"name": _("Privilege Leave"),
"allow_encashment": 0,
"is_carry_forward": 0,
"include_holiday": 1,
},
{
"doctype": "Leave Type",
"leave_type_name": _("Leave Without Pay"),
"name": _("Leave Without Pay"),
"allow_encashment": 0,
"is_carry_forward": 0,
"is_lwp": 1,
"include_holiday": 1,
},
# Employment Type
{"doctype": "Employment Type", "employee_type_name": _("Full-time")},
{"doctype": "Employment Type", "employee_type_name": _("Part-time")},
{"doctype": "Employment Type", "employee_type_name": _("Probation")},
{"doctype": "Employment Type", "employee_type_name": _("Contract")},
{"doctype": "Employment Type", "employee_type_name": _("Commission")},
{"doctype": "Employment Type", "employee_type_name": _("Piecework")},
{"doctype": "Employment Type", "employee_type_name": _("Intern")},
{"doctype": "Employment Type", "employee_type_name": _("Apprentice")},
# Stock Entry Type
{"doctype": "Stock Entry Type", "name": "Material Issue", "purpose": "Material Issue"},
{"doctype": "Stock Entry Type", "name": "Material Receipt", "purpose": "Material Receipt"},
@ -189,22 +104,6 @@ def install(country=None):
"name": "Material Consumption for Manufacture",
"purpose": "Material Consumption for Manufacture",
},
# Designation
{"doctype": "Designation", "designation_name": _("CEO")},
{"doctype": "Designation", "designation_name": _("Manager")},
{"doctype": "Designation", "designation_name": _("Analyst")},
{"doctype": "Designation", "designation_name": _("Engineer")},
{"doctype": "Designation", "designation_name": _("Accountant")},
{"doctype": "Designation", "designation_name": _("Secretary")},
{"doctype": "Designation", "designation_name": _("Associate")},
{"doctype": "Designation", "designation_name": _("Administrative Officer")},
{"doctype": "Designation", "designation_name": _("Business Development Manager")},
{"doctype": "Designation", "designation_name": _("HR Manager")},
{"doctype": "Designation", "designation_name": _("Project Manager")},
{"doctype": "Designation", "designation_name": _("Head of Marketing and Sales")},
{"doctype": "Designation", "designation_name": _("Software Developer")},
{"doctype": "Designation", "designation_name": _("Designer")},
{"doctype": "Designation", "designation_name": _("Researcher")},
# territory: with two default territories, one for home country and one named Rest of the World
{
"doctype": "Territory",
@ -356,11 +255,6 @@ def install(country=None):
{"doctype": "Issue Priority", "name": _("Low")},
{"doctype": "Issue Priority", "name": _("Medium")},
{"doctype": "Issue Priority", "name": _("High")},
# Job Applicant Source
{"doctype": "Job Applicant Source", "source_name": _("Website Listing")},
{"doctype": "Job Applicant Source", "source_name": _("Walk In")},
{"doctype": "Job Applicant Source", "source_name": _("Employee Referral")},
{"doctype": "Job Applicant Source", "source_name": _("Campaign")},
{"doctype": "Email Account", "email_id": "sales@example.com", "append_to": "Opportunity"},
{"doctype": "Email Account", "email_id": "support@example.com", "append_to": "Issue"},
{"doctype": "Email Account", "email_id": "jobs@example.com", "append_to": "Job Applicant"},
@ -374,18 +268,6 @@ def install(country=None):
{"doctype": "Project Type", "project_type": "Internal"},
{"doctype": "Project Type", "project_type": "External"},
{"doctype": "Project Type", "project_type": "Other"},
{"doctype": "Offer Term", "offer_term": _("Date of Joining")},
{"doctype": "Offer Term", "offer_term": _("Annual Salary")},
{"doctype": "Offer Term", "offer_term": _("Probationary Period")},
{"doctype": "Offer Term", "offer_term": _("Employee Benefits")},
{"doctype": "Offer Term", "offer_term": _("Working Hours")},
{"doctype": "Offer Term", "offer_term": _("Stock Options")},
{"doctype": "Offer Term", "offer_term": _("Department")},
{"doctype": "Offer Term", "offer_term": _("Job Description")},
{"doctype": "Offer Term", "offer_term": _("Responsibilities")},
{"doctype": "Offer Term", "offer_term": _("Leaves per Year")},
{"doctype": "Offer Term", "offer_term": _("Notice Period")},
{"doctype": "Offer Term", "offer_term": _("Incentives")},
{"doctype": "Print Heading", "print_heading": _("Credit Note")},
{"doctype": "Print Heading", "print_heading": _("Debit Note")},
# Share Management
@ -418,73 +300,6 @@ def install(country=None):
{"doctype": "Sales Partner Type", "sales_partner_type": _(d)} for d in default_sales_partner_type
]
base_path = frappe.get_app_path("erpnext", "hr", "doctype")
response = frappe.read_file(
os.path.join(base_path, "leave_application/leave_application_email_template.html")
)
records += [
{
"doctype": "Email Template",
"name": _("Leave Approval Notification"),
"response": response,
"subject": _("Leave Approval Notification"),
"owner": frappe.session.user,
}
]
records += [
{
"doctype": "Email Template",
"name": _("Leave Status Notification"),
"response": response,
"subject": _("Leave Status Notification"),
"owner": frappe.session.user,
}
]
response = frappe.read_file(
os.path.join(base_path, "interview/interview_reminder_notification_template.html")
)
records += [
{
"doctype": "Email Template",
"name": _("Interview Reminder"),
"response": response,
"subject": _("Interview Reminder"),
"owner": frappe.session.user,
}
]
response = frappe.read_file(
os.path.join(base_path, "interview/interview_feedback_reminder_template.html")
)
records += [
{
"doctype": "Email Template",
"name": _("Interview Feedback Reminder"),
"response": response,
"subject": _("Interview Feedback Reminder"),
"owner": frappe.session.user,
}
]
response = frappe.read_file(
os.path.join(base_path, "exit_interview/exit_questionnaire_notification_template.html")
)
records += [
{
"doctype": "Email Template",
"name": _("Exit Questionnaire Notification"),
"response": response,
"subject": _("Exit Questionnaire Notification"),
"owner": frappe.session.user,
}
]
base_path = frappe.get_app_path("erpnext", "stock", "doctype")
response = frappe.read_file(
os.path.join(base_path, "delivery_trip/dispatch_notification_template.html")
@ -514,7 +329,6 @@ def set_more_defaults():
# Do more setup stuff that can be done here with no dependencies
update_selling_defaults()
update_buying_defaults()
update_hr_defaults()
add_uom_data()
update_item_variant_settings()
@ -539,22 +353,6 @@ def update_buying_defaults():
buying_settings.save()
def update_hr_defaults():
hr_settings = frappe.get_doc("HR Settings")
hr_settings.emp_created_by = "Naming Series"
hr_settings.leave_approval_notification_template = _("Leave Approval Notification")
hr_settings.leave_status_notification_template = _("Leave Status Notification")
hr_settings.send_interview_reminder = 1
hr_settings.interview_reminder_template = _("Interview Reminder")
hr_settings.remind_before = "00:15:00"
hr_settings.send_interview_feedback_reminder = 1
hr_settings.feedback_reminder_notification_template = _("Interview Feedback Reminder")
hr_settings.save()
def update_item_variant_settings():
# set no copy fields of an item doctype to item variant settings
doc = frappe.get_doc("Item Variant Settings")