Retirement Age option in HR Settings
diff --git a/erpnext/hr/doctype/employee/employee.py b/erpnext/hr/doctype/employee/employee.py
index 4919229..8257ec2 100755
--- a/erpnext/hr/doctype/employee/employee.py
+++ b/erpnext/hr/doctype/employee/employee.py
@@ -186,7 +186,12 @@
ret = {}
if date_of_birth:
try:
- dt = getdate(date_of_birth) + datetime.timedelta(21915)
+ retirement_age = frappe.db.get_single_value("HR Settings", "retirement_age")
+ if retirement_age:
+ dt = getdate(date_of_birth) + datetime.timedelta(int(retirement_age)*365.2425)
+ else:
+ dt = getdate(date_of_birth) + datetime.timedelta(21914.55)
+
ret = {'date_of_retirement': dt.strftime('%Y-%m-%d')}
except ValueError:
# invalid date
diff --git a/erpnext/hr/doctype/hr_settings/hr_settings.json b/erpnext/hr/doctype/hr_settings/hr_settings.json
index 561f013..599aacc 100644
--- a/erpnext/hr/doctype/hr_settings/hr_settings.json
+++ b/erpnext/hr/doctype/hr_settings/hr_settings.json
@@ -2,6 +2,7 @@
"allow_copy": 0,
"allow_import": 0,
"allow_rename": 0,
+ "beta": 0,
"creation": "2013-08-02 13:45:23",
"custom": 0,
"docstatus": 0,
@@ -36,6 +37,33 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "default": "",
+ "description": "Enter retirement age in years",
+ "fieldname": "retirement_age",
+ "fieldtype": "Data",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "Retirement Age",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
"default": "Naming Series",
"description": "Employee record is created using selected field. ",
"fieldname": "emp_created_by",
@@ -165,13 +193,14 @@
"hide_toolbar": 0,
"icon": "icon-cog",
"idx": 1,
+ "image_view": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 1,
"istable": 0,
"max_attachments": 0,
- "modified": "2016-04-26 05:54:32.501880",
+ "modified": "2016-06-25 17:43:06.643469",
"modified_by": "Administrator",
"module": "HR",
"name": "HR Settings",
@@ -191,6 +220,8 @@
"print": 1,
"read": 1,
"report": 0,
+ "restrict": 0,
+ "restricted": 0,
"role": "System Manager",
"set_user_permissions": 0,
"share": 1,
@@ -198,7 +229,9 @@
"write": 1
}
],
+ "quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
- "sort_order": "ASC"
+ "sort_order": "ASC",
+ "track_seen": 0
}
\ No newline at end of file