Retirement Age option in HR Settings

This commit is contained in:
Kanchan Chauhan 2016-06-25 17:45:16 +05:30
parent 994fa8dcef
commit 4c0df04db0
2 changed files with 41 additions and 3 deletions

View File

@ -186,7 +186,12 @@ def get_retirement_date(date_of_birth=None):
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

View File

@ -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,
@ -32,6 +33,33 @@
"set_only_once": 0,
"unique": 0
},
{
"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,
@ -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
}