diff --git a/erpnext/hr/doctype/hr_settings/hr_settings.js b/erpnext/hr/doctype/hr_settings/hr_settings.js index fd082fda09b..e9df7c32b3b 100644 --- a/erpnext/hr/doctype/hr_settings/hr_settings.js +++ b/erpnext/hr/doctype/hr_settings/hr_settings.js @@ -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); } diff --git a/erpnext/payroll/doctype/payroll_settings/payroll_settings.json b/erpnext/payroll/doctype/payroll_settings/payroll_settings.json index 54377e94b30..8863a0415eb 100644 --- a/erpnext/payroll/doctype/payroll_settings/payroll_settings.json +++ b/erpnext/payroll/doctype/payroll_settings/payroll_settings.json @@ -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", diff --git a/erpnext/setup/setup_wizard/operations/defaults_setup.py b/erpnext/setup/setup_wizard/operations/defaults_setup.py index 6dd0fb1403f..76484753c3a 100644 --- a/erpnext/setup/setup_wizard/operations/defaults_setup.py +++ b/erpnext/setup/setup_wizard/operations/defaults_setup.py @@ -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') diff --git a/erpnext/setup/setup_wizard/operations/install_fixtures.py b/erpnext/setup/setup_wizard/operations/install_fixtures.py index 3dcb63867c1..5789081b91f 100644 --- a/erpnext/setup/setup_wizard/operations/install_fixtures.py +++ b/erpnext/setup/setup_wizard/operations/install_fixtures.py @@ -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')