on submit: create additional salary component, revert on cancel
This commit is contained in:
parent
4c721cbe0f
commit
504855e1a0
File diff suppressed because it is too large
Load Diff
@ -188,7 +188,7 @@
|
||||
"in_standard_filter": 0,
|
||||
"label": "Leave Allocation",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"no_copy": 1,
|
||||
"options": "Leave Allocation",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
@ -220,7 +220,7 @@
|
||||
"in_standard_filter": 0,
|
||||
"label": "Leave Balance",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
@ -251,7 +251,7 @@
|
||||
"in_standard_filter": 0,
|
||||
"label": "Encashable days",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
@ -344,7 +344,7 @@
|
||||
"in_standard_filter": 0,
|
||||
"label": "Encashment Amount",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
@ -389,6 +389,38 @@
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "additional_component",
|
||||
"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": "Additional Salary Component",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"options": "Additional Salary Component",
|
||||
"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
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
@ -401,7 +433,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2018-05-11 19:15:17.460624",
|
||||
"modified": "2018-05-15 17:54:47.167810",
|
||||
"modified_by": "Administrator",
|
||||
"module": "HR",
|
||||
"name": "Leave Encashment",
|
||||
|
@ -26,16 +26,16 @@ class LeaveEncashment(Document):
|
||||
def on_submit(self):
|
||||
if not self.leave_allocation:
|
||||
self.leave_allocation = self.get_leave_allocation()
|
||||
additional_component = frappe.new_doc({"doctype": "Additional Salary Component",
|
||||
"company": frappe.get_value("Employee", self.employee, "company"),
|
||||
"employee": self.employee,
|
||||
"salary_component": frappe.get_value("Leave Type", self.leave_type, "earning_component"),
|
||||
"from_date": self.encashment_date,
|
||||
"to_date": self.encashment_date,
|
||||
"amount": self.encashment_amount,
|
||||
"docstatus": 1
|
||||
}).insert()
|
||||
self.set_value("additional_component", additional_component.name)
|
||||
additional_component = frappe.new_doc("Additional Salary Component")
|
||||
additional_component.company = frappe.get_value("Employee", self.employee, "company")
|
||||
additional_component.employee = self.employee
|
||||
additional_component.salary_component = frappe.get_value("Leave Type", self.leave_type, "earning_component")
|
||||
additional_component.from_date = self.encashment_date
|
||||
additional_component.to_date = self.encashment_date
|
||||
additional_component.amount = self.encashment_amount
|
||||
additional_component.submit()
|
||||
|
||||
self.db_set("additional_component", additional_component.name)
|
||||
|
||||
# Set encashed leaves in Allocation
|
||||
frappe.db.set_value("Leave Allocation", self.leave_allocation, "total_leaves_encashed",
|
||||
|
Loading…
x
Reference in New Issue
Block a user