feat: settings for Overtime

This commit is contained in:
Anurag Mishra
2021-05-10 14:32:44 +05:30
parent 25a2f2b90e
commit 8f1850b21c
4 changed files with 60 additions and 2 deletions

View File

@@ -2,6 +2,16 @@
// For license information, please see license.txt
frappe.ui.form.on('HR Settings', {
refresh: function(frm) {
frm.set_query('overtime_salary_component', function() {
return {
filters: {
type: "Earning"
}
};
});
},
restrict_backdated_leave_application: function(frm) {
frm.toggle_reqd("role_allowed_to_create_backdated_leave_application", frm.doc.restrict_backdated_leave_application);
}

View File

@@ -16,7 +16,12 @@
"email_salary_slip_to_employee",
"encrypt_salary_slips_in_emails",
"show_leave_balances_in_salary_slip",
"password_policy"
"password_policy",
"section_break_12",
"overtime_based_on",
"overtime_salary_component",
"column_break_14",
"fetch_standard_working_hours_from_shift_type"
],
"fields": [
{
@@ -91,13 +96,41 @@
"fieldname": "show_leave_balances_in_salary_slip",
"fieldtype": "Check",
"label": "Show Leave Balances in Salary Slip"
},
{
"fieldname": "overtime_salary_component",
"fieldtype": "Link",
"label": "Overtime Salary Component",
"options": "Salary Component"
},
{
"fieldname": "section_break_12",
"fieldtype": "Section Break"
},
{
"default": "0",
"description": "If unchecked, Standard Working Hours as defined in HR Settings will be taken into consideration.",
"fieldname": "fetch_standard_working_hours_from_shift_type",
"fieldtype": "Check",
"label": "Fetch Standard Working Hours from Shift Type"
},
{
"fieldname": "column_break_14",
"fieldtype": "Column Break"
},
{
"default": "Attendance",
"fieldname": "overtime_based_on",
"fieldtype": "Select",
"label": "Calculate Overtime Hours Based On",
"options": "Attendance\nTimesheet"
}
],
"icon": "fa fa-cog",
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
"modified": "2021-03-03 17:49:59.579723",
"modified": "2021-05-10 12:56:08.161319",
"modified_by": "Administrator",
"module": "Payroll",
"name": "Payroll Settings",

View File

@@ -64,6 +64,12 @@ def set_default_settings(args):
hr_settings.leave_status_notification_template = _("Leave Status Notification")
hr_settings.save()
payroll_settings = frappe.get_doc("Payroll Settings")
payroll_settings.overtime_based_on = "Attendance"
Payroll_settings.overtime_salary_component = _("Overtime Allowance")
payroll_settings.save()
def set_no_copy_fields_in_variant_settings():
# set no copy fields of an item doctype to item variant settings
doc = frappe.get_doc('Item Variant Settings')

View File

@@ -54,6 +54,7 @@ def install(country=None):
{'doctype': 'Salary Component', 'salary_component': _('Income Tax'), 'description': _('Income Tax'), 'type': 'Deduction', 'is_income_tax_component': 1},
{'doctype': 'Salary Component', 'salary_component': _('Basic'), 'description': _('Basic'), 'type': 'Earning'},
{'doctype': 'Salary Component', 'salary_component': _('Arrear'), 'description': _('Arrear'), 'type': 'Earning'},
{'doctype': 'Salary Component', 'salary_component': _('Overtime Allowance'), 'description': _('Overtime Allowance'), 'type': 'Earning'},
{'doctype': 'Salary Component', 'salary_component': _('Leave Encashment'), 'description': _('Leave Encashment'), 'type': 'Earning'},
@@ -286,6 +287,7 @@ def set_more_defaults():
update_selling_defaults()
update_buying_defaults()
update_hr_defaults()
update_payroll_defaults()
add_uom_data()
update_item_variant_settings()
@@ -315,6 +317,13 @@ def update_hr_defaults():
hr_settings.leave_status_notification_template = _("Leave Status Notification")
hr_settings.save()
def update_payroll_defaults():
payroll_settings = frappe.get_doc("Payroll Settings")
payroll_settings.overtime_based_on = "Attendance"
Payroll_settings.overtime_salary_component = _("Overtime Allowance")
payroll_settings.save()
def update_item_variant_settings():
# set no copy fields of an item doctype to item variant settings
doc = frappe.get_doc('Item Variant Settings')