Compensatory Leave Request - add link to leave allocation

This commit is contained in:
Jamsheer 2018-05-15 19:42:27 +05:30
parent ebb68afecb
commit 3beeb7255f
2 changed files with 36 additions and 3 deletions

View File

@ -232,6 +232,38 @@
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "leave_allocation",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Leave Allocation",
"length": 0,
"no_copy": 0,
"options": "Leave Allocation",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
@ -274,7 +306,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2018-04-14 15:36:39.668733",
"modified": "2018-05-15 19:37:13.742710",
"modified_by": "Administrator",
"module": "HR",
"name": "Compensatory Leave Request",

View File

@ -28,7 +28,8 @@ class CompensatoryLeaveRequest(Document):
leave_allocation.new_leaves_allocated += date_difference
leave_allocation.submit()
else:
self.create_leave_allocation(leave_period, date_difference)
leave_allocation = self.create_leave_allocation(leave_period, date_difference)
self.db_set("leave_allocation", leave_allocation.name)
else:
frappe.throw(_("There is no leave period in between {0} and {1}").format(self.work_from_date, self.work_end_date))
@ -63,9 +64,9 @@ class CompensatoryLeaveRequest(Document):
allocation.to_date = leave_period[0].to_date
allocation.new_leaves_allocated = date_difference
allocation.total_leaves_allocated = date_difference
allocation.compensatory_request = self.name
allocation.description = self.reason
if is_carry_forward == 1:
allocation.carry_forward = True
allocation.save(ignore_permissions = True)
allocation.submit()
return allocation