feat: Additon of leave details in Salary Slip (#24674)
* feat: Additon of leave details in Salary Slip * fix: Change leaves to leave
This commit is contained in:
parent
d96be3f9f1
commit
11092d0824
@ -15,6 +15,7 @@
|
||||
"daily_wages_fraction_for_half_day",
|
||||
"email_salary_slip_to_employee",
|
||||
"encrypt_salary_slips_in_emails",
|
||||
"show_leave_balances_in_salary_slip",
|
||||
"password_policy"
|
||||
],
|
||||
"fields": [
|
||||
@ -23,58 +24,44 @@
|
||||
"fieldname": "payroll_based_on",
|
||||
"fieldtype": "Select",
|
||||
"label": "Calculate Payroll Working Days Based On",
|
||||
"options": "Leave\nAttendance",
|
||||
"show_days": 1,
|
||||
"show_seconds": 1
|
||||
"options": "Leave\nAttendance"
|
||||
},
|
||||
{
|
||||
"fieldname": "max_working_hours_against_timesheet",
|
||||
"fieldtype": "Float",
|
||||
"label": "Max working hours against Timesheet",
|
||||
"show_days": 1,
|
||||
"show_seconds": 1
|
||||
"label": "Max working hours against Timesheet"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"description": "If checked, Total no. of Working Days will include holidays, and this will reduce the value of Salary Per Day",
|
||||
"fieldname": "include_holidays_in_total_working_days",
|
||||
"fieldtype": "Check",
|
||||
"label": "Include holidays in Total no. of Working Days",
|
||||
"show_days": 1,
|
||||
"show_seconds": 1
|
||||
"label": "Include holidays in Total no. of Working Days"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"description": "If checked, hides and disables Rounded Total field in Salary Slips",
|
||||
"fieldname": "disable_rounded_total",
|
||||
"fieldtype": "Check",
|
||||
"label": "Disable Rounded Total",
|
||||
"show_days": 1,
|
||||
"show_seconds": 1
|
||||
"label": "Disable Rounded Total"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_11",
|
||||
"fieldtype": "Column Break",
|
||||
"show_days": 1,
|
||||
"show_seconds": 1
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"default": "0.5",
|
||||
"description": "The fraction of daily wages to be paid for half-day attendance",
|
||||
"fieldname": "daily_wages_fraction_for_half_day",
|
||||
"fieldtype": "Float",
|
||||
"label": "Fraction of Daily Salary for Half Day",
|
||||
"show_days": 1,
|
||||
"show_seconds": 1
|
||||
"label": "Fraction of Daily Salary for Half Day"
|
||||
},
|
||||
{
|
||||
"default": "1",
|
||||
"description": "Emails salary slip to employee based on preferred email selected in Employee",
|
||||
"fieldname": "email_salary_slip_to_employee",
|
||||
"fieldtype": "Check",
|
||||
"label": "Email Salary Slip to Employee",
|
||||
"show_days": 1,
|
||||
"show_seconds": 1
|
||||
"label": "Email Salary Slip to Employee"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
@ -82,9 +69,7 @@
|
||||
"description": "The salary slip emailed to the employee will be password protected, the password will be generated based on the password policy.",
|
||||
"fieldname": "encrypt_salary_slips_in_emails",
|
||||
"fieldtype": "Check",
|
||||
"label": "Encrypt Salary Slips in Emails",
|
||||
"show_days": 1,
|
||||
"show_seconds": 1
|
||||
"label": "Encrypt Salary Slips in Emails"
|
||||
},
|
||||
{
|
||||
"depends_on": "eval: doc.encrypt_salary_slips_in_emails == 1",
|
||||
@ -92,24 +77,27 @@
|
||||
"fieldname": "password_policy",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Password Policy",
|
||||
"show_days": 1,
|
||||
"show_seconds": 1
|
||||
"label": "Password Policy"
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.payroll_based_on == 'Attendance'",
|
||||
"fieldname": "consider_unmarked_attendance_as",
|
||||
"fieldtype": "Select",
|
||||
"label": "Consider Unmarked Attendance As",
|
||||
"options": "Present\nAbsent",
|
||||
"show_days": 1,
|
||||
"show_seconds": 1
|
||||
"options": "Present\nAbsent"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "show_leave_balances_in_salary_slip",
|
||||
"fieldtype": "Check",
|
||||
"label": "Show Leave Balances in Salary Slip"
|
||||
}
|
||||
],
|
||||
"icon": "fa fa-cog",
|
||||
"index_web_pages_for_search": 1,
|
||||
"issingle": 1,
|
||||
"links": [],
|
||||
"modified": "2020-06-22 17:00:58.408030",
|
||||
"modified": "2021-02-19 11:07:55.873991",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Payroll",
|
||||
"name": "Payroll Settings",
|
||||
|
@ -80,6 +80,8 @@
|
||||
"total_in_words",
|
||||
"column_break_69",
|
||||
"base_total_in_words",
|
||||
"leave_details_section",
|
||||
"leave_details",
|
||||
"section_break_75",
|
||||
"amended_from"
|
||||
],
|
||||
@ -612,13 +614,25 @@
|
||||
"label": "Month To Date(Company Currency)",
|
||||
"options": "Company:company:default_currency",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "leave_details_section",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Leave Details"
|
||||
},
|
||||
{
|
||||
"fieldname": "leave_details",
|
||||
"fieldtype": "Table",
|
||||
"label": "Leave Details",
|
||||
"options": "Salary Slip Leave",
|
||||
"read_only": 1
|
||||
}
|
||||
],
|
||||
"icon": "fa fa-file-text",
|
||||
"idx": 9,
|
||||
"is_submittable": 1,
|
||||
"links": [],
|
||||
"modified": "2021-01-14 13:37:38.180920",
|
||||
"modified": "2021-02-19 11:48:05.383945",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Payroll",
|
||||
"name": "Salary Slip",
|
||||
|
@ -19,6 +19,7 @@ from erpnext.payroll.doctype.employee_benefit_application.employee_benefit_appli
|
||||
from erpnext.payroll.doctype.employee_benefit_claim.employee_benefit_claim import get_benefit_claim_amount, get_last_payroll_period_benefits
|
||||
from erpnext.loan_management.doctype.loan_repayment.loan_repayment import calculate_amounts, create_repayment_entry
|
||||
from erpnext.accounts.utils import get_fiscal_year
|
||||
from six import iteritems
|
||||
|
||||
class SalarySlip(TransactionBase):
|
||||
def __init__(self, *args, **kwargs):
|
||||
@ -53,6 +54,7 @@ class SalarySlip(TransactionBase):
|
||||
self.compute_year_to_date()
|
||||
self.compute_month_to_date()
|
||||
self.compute_component_wise_year_to_date()
|
||||
self.add_leave_balances()
|
||||
|
||||
if frappe.db.get_single_value("Payroll Settings", "max_working_hours_against_timesheet"):
|
||||
max_working_hours = frappe.db.get_single_value("Payroll Settings", "max_working_hours_against_timesheet")
|
||||
@ -1212,6 +1214,22 @@ class SalarySlip(TransactionBase):
|
||||
|
||||
return period_start_date, period_end_date
|
||||
|
||||
def add_leave_balances(self):
|
||||
self.set('leave_details', [])
|
||||
|
||||
if frappe.db.get_single_value('Payroll Settings', 'show_leave_balances_in_salary_slip'):
|
||||
from erpnext.hr.doctype.leave_application.leave_application import get_leave_details
|
||||
leave_details = get_leave_details(self.employee, self.end_date)
|
||||
|
||||
for leave_type, leave_values in iteritems(leave_details['leave_allocation']):
|
||||
self.append('leave_details', {
|
||||
'leave_type': leave_type,
|
||||
'total_allocated_leaves': flt(leave_values.get('total_leaves')),
|
||||
'expired_leaves': flt(leave_values.get('expired_leaves')),
|
||||
'used_leaves': flt(leave_values.get('leaves_taken')),
|
||||
'pending_leaves': flt(leave_values.get('pending_leaves')),
|
||||
'available_leaves': flt(leave_values.get('remaining_leaves'))
|
||||
})
|
||||
|
||||
def unlink_ref_doc_from_salary_slip(ref_no):
|
||||
linked_ss = frappe.db.sql_list("""select name from `tabSalary Slip`
|
||||
|
@ -0,0 +1,78 @@
|
||||
{
|
||||
"actions": [],
|
||||
"creation": "2021-02-19 11:45:18.173417",
|
||||
"doctype": "DocType",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"leave_type",
|
||||
"total_allocated_leaves",
|
||||
"expired_leaves",
|
||||
"used_leaves",
|
||||
"pending_leaves",
|
||||
"available_leaves"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "leave_type",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Leave Type",
|
||||
"no_copy": 1,
|
||||
"options": "Leave Type",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "total_allocated_leaves",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 1,
|
||||
"label": "Total Allocated Leave",
|
||||
"no_copy": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "expired_leaves",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 1,
|
||||
"label": "Expired Leave",
|
||||
"no_copy": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "used_leaves",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 1,
|
||||
"label": "Used Leave",
|
||||
"no_copy": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "pending_leaves",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 1,
|
||||
"label": "Pending Leave",
|
||||
"no_copy": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "available_leaves",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 1,
|
||||
"label": "Available Leave",
|
||||
"no_copy": 1,
|
||||
"read_only": 1
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2021-02-19 10:47:48.546724",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Payroll",
|
||||
"name": "Salary Slip Leave",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 1
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
# import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
class SalarySlipLeave(Document):
|
||||
pass
|
Loading…
Reference in New Issue
Block a user