From 493eea19e84b6596c3410fa921ab84633ae4b7db Mon Sep 17 00:00:00 2001 From: Anurag Mishra Date: Tue, 18 Aug 2020 15:02:32 +0530 Subject: [PATCH] feat: added link from desk page and some minor fixes --- .../payroll/desk_page/payroll/payroll.json | 4 +- erpnext/regional/india/setup.py | 28 ++-- .../regional/united_arab_emirates/setup.py | 153 +++++++++--------- 3 files changed, 94 insertions(+), 91 deletions(-) diff --git a/erpnext/payroll/desk_page/payroll/payroll.json b/erpnext/payroll/desk_page/payroll/payroll.json index 285e3b3a13..1caf9c7b4e 100644 --- a/erpnext/payroll/desk_page/payroll/payroll.json +++ b/erpnext/payroll/desk_page/payroll/payroll.json @@ -13,7 +13,7 @@ { "hidden": 0, "label": "Compensations", - "links": "[\n {\n \"label\": \"Additional Salary\",\n \"name\": \"Additional Salary\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n \n },\n {\n \"label\": \"Retention Bonus\",\n \"name\": \"Retention Bonus\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Employee Incentive\",\n \"name\": \"Employee Incentive\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Employee Benefit Application\",\n \"name\": \"Employee Benefit Application\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Employee Benefit Claim\",\n \"name\": \"Employee Benefit Claim\",\n \"type\": \"doctype\"\n }\n]" + "links": "[\n {\n \"label\": \"Additional Salary\",\n \"name\": \"Additional Salary\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n \n },\n {\n \"label\": \"Retention Bonus\",\n \"name\": \"Retention Bonus\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Employee Incentive\",\n \"name\": \"Employee Incentive\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Gratuity Rule\",\n \"name\": \"Gratuity Rule\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Gratuity\",\n \"name\": \"Gratuity\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Employee Benefit Application\",\n \"name\": \"Employee Benefit Application\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Employee Benefit Claim\",\n \"name\": \"Employee Benefit Claim\",\n \"type\": \"doctype\"\n }\n]" }, { "hidden": 0, @@ -38,7 +38,7 @@ "idx": 0, "is_standard": 1, "label": "Payroll", - "modified": "2020-08-10 19:38:45.976209", + "modified": "2020-08-18 15:00:55.671767", "modified_by": "Administrator", "module": "Payroll", "name": "Payroll", diff --git a/erpnext/regional/india/setup.py b/erpnext/regional/india/setup.py index 9be5239d5e..d46c372fdd 100644 --- a/erpnext/regional/india/setup.py +++ b/erpnext/regional/india/setup.py @@ -799,19 +799,19 @@ def get_tds_details(accounts, fiscal_year): def create_gratuity_rule(): # Standard Indain Gratuity Rule + if not frappe.db.exists("Gratuity Rule", "Indian Standard Gratuity Rule"): + rule = frappe.new_doc("Gratuity Rule") + rule.name = "Indian Standard Gratuity Rule" + rule.calculate_gratuity_amount_based_on = "Current Slab" + rule.work_experience_calculation_method = "Round Off Work Experience" + rule.minimum_year_for_gratuity = 5 - rule = frappe.new_doc("Gratuity Rule") - rule.name = "Indian Standard Gratuity Rule" - rule.calculate_gratuity_amount_based_on = "Current Slab" - rule.work_experience_calculation_method = "Round Off Work Experience" - rule.minimum_year_for_gratuity = 5 + fraction = 15/26 + rule.append("gratuity_rule_slabs", { + "from_year": 0, + "to_year":0, + "fraction_of_applicable_earnings": fraction + }) - fraction = 15/26 - rule.append("gratuity_rule_slabs", { - "from_year": 0, - "to_year":0, - "fraction_of_applicable_earnings": fraction - }) - - rule.flags.ignore_mandatory = True - rule.save() \ No newline at end of file + rule.flags.ignore_mandatory = True + rule.save() \ No newline at end of file diff --git a/erpnext/regional/united_arab_emirates/setup.py b/erpnext/regional/united_arab_emirates/setup.py index 72d7c13204..b91318c9af 100644 --- a/erpnext/regional/united_arab_emirates/setup.py +++ b/erpnext/regional/united_arab_emirates/setup.py @@ -165,97 +165,100 @@ def create_gratuity_rule(): # Standard Gratuity Rules for UAE # Rule Under Limited Contract - rule_1 = frappe.new_doc("Gratuity Rule") - rule_1.name = "Rule Under Limited Contract (UAE)" - rule_1.calculate_gratuity_amount_based_on = "Sum of all previous slabs" - rule_1.work_experience_calculation_method = "Take Exact Completed Years" - rule_1.minimum_year_for_gratuity = 1 + if not frappe.db.exists("Gratuity Rule", "Rule Under Limited Contract (UAE)"): + rule_1 = frappe.new_doc("Gratuity Rule") + rule_1.name = "Rule Under Limited Contract (UAE)" + rule_1.calculate_gratuity_amount_based_on = "Sum of all previous slabs" + rule_1.work_experience_calculation_method = "Take Exact Completed Years" + rule_1.minimum_year_for_gratuity = 1 - rule_1.append("gratuity_rule_slabs", { - "from_year": 0, - "to_year":1, - "fraction_of_applicable_earnings": 0 - }) + rule_1.append("gratuity_rule_slabs", { + "from_year": 0, + "to_year":1, + "fraction_of_applicable_earnings": 0 + }) - rule_1.append("gratuity_rule_slabs", { - "from_year": 1, - "to_year":5, - "fraction_of_applicable_earnings": 21/30 - }) + rule_1.append("gratuity_rule_slabs", { + "from_year": 1, + "to_year":5, + "fraction_of_applicable_earnings": 21/30 + }) - rule_1.append("gratuity_rule_slabs", { - "from_year": 5, - "to_year":0, - "fraction_of_applicable_earnings": 1 - }) + rule_1.append("gratuity_rule_slabs", { + "from_year": 5, + "to_year":0, + "fraction_of_applicable_earnings": 1 + }) # Rule Under Unlimited Contract on termination - rule_2 = frappe.new_doc("Gratuity Rule") - rule_2.name = "Rule Under Unlimited Contract on termination (UAE)" - rule_2.calculate_gratuity_amount_based_on = "Current Slab" - rule_2.work_experience_calculation_method = "Take Exact Completed Years" - rule_2.minimum_year_for_gratuity = 1 + if not frappe.db.exists("Gratuity Rule", "Rule Under Unlimited Contract on termination (UAE)"): + rule_2 = frappe.new_doc("Gratuity Rule") + rule_2.name = "Rule Under Unlimited Contract on termination (UAE)" + rule_2.calculate_gratuity_amount_based_on = "Current Slab" + rule_2.work_experience_calculation_method = "Take Exact Completed Years" + rule_2.minimum_year_for_gratuity = 1 - rule_2.append("gratuity_rule_slabs", { - "from_year": 0, - "to_year":1, - "fraction_of_applicable_earnings": 0 - }) + rule_2.append("gratuity_rule_slabs", { + "from_year": 0, + "to_year":1, + "fraction_of_applicable_earnings": 0 + }) - rule_2.append("gratuity_rule_slabs", { - "from_year": 1, - "to_year":5, - "fraction_of_applicable_earnings": 21/30 - }) + rule_2.append("gratuity_rule_slabs", { + "from_year": 1, + "to_year":5, + "fraction_of_applicable_earnings": 21/30 + }) - rule_2.append("gratuity_rule_slabs", { - "from_year": 5, - "to_year":0, - "fraction_of_applicable_earnings": 1 - }) + rule_2.append("gratuity_rule_slabs", { + "from_year": 5, + "to_year":0, + "fraction_of_applicable_earnings": 1 + }) # Rule Under Unlimited Contract - rule_3 = frappe.new_doc("Gratuity Rule") - rule_3.name = "Rule Under Unlimited Contract on resignation (UAE)" - rule_3.calculate_gratuity_amount_based_on = "Current Slab" - rule_3.work_experience_calculation_method = "Take Exact Completed Years" - rule_3.minimum_year_for_gratuity = 1 + if not frappe.db.exists("Gratuity Rule", "Rule Under Unlimited Contract on resignation (UAE)"): + rule_3 = frappe.new_doc("Gratuity Rule") + rule_3.name = "Rule Under Unlimited Contract on resignation (UAE)" + rule_3.calculate_gratuity_amount_based_on = "Current Slab" + rule_3.work_experience_calculation_method = "Take Exact Completed Years" + rule_3.minimum_year_for_gratuity = 1 - rule_3.append("gratuity_rule_slabs", { - "from_year": 0, - "to_year":1, - "fraction_of_applicable_earnings": 0 - }) + rule_3.append("gratuity_rule_slabs", { + "from_year": 0, + "to_year":1, + "fraction_of_applicable_earnings": 0 + }) - fraction_of_applicable_earnings = 1/3 * 21/30 - rule_3.append("gratuity_rule_slabs", { - "from_year": 1, - "to_year":3, - "fraction_of_applicable_earnings": fraction_of_applicable_earnings - }) + fraction_of_applicable_earnings = 1/3 * 21/30 + rule_3.append("gratuity_rule_slabs", { + "from_year": 1, + "to_year":3, + "fraction_of_applicable_earnings": fraction_of_applicable_earnings + }) - fraction_of_applicable_earnings = 2/3 * 21/30 - rule_3.append("gratuity_rule_slabs", { - "from_year": 3, - "to_year":5, - "fraction_of_applicable_earnings": fraction_of_applicable_earnings - }) + fraction_of_applicable_earnings = 2/3 * 21/30 + rule_3.append("gratuity_rule_slabs", { + "from_year": 3, + "to_year":5, + "fraction_of_applicable_earnings": fraction_of_applicable_earnings + }) - fraction_of_applicable_earnings = 21/30 - rule_3.append("gratuity_rule_slabs", { - "from_year": 5, - "to_year":0, - "fraction_of_applicable_earnings": fraction_of_applicable_earnings - }) + fraction_of_applicable_earnings = 21/30 + rule_3.append("gratuity_rule_slabs", { + "from_year": 5, + "to_year":0, + "fraction_of_applicable_earnings": fraction_of_applicable_earnings + }) - #for applicable salary component user need to set this by its own - rule_1.flags.ignore_mandatory = True - rule_2.flags.ignore_mandatory = True - rule_3.flags.ignore_mandatory = True + #for applicable salary component user need to set this by its own + rule_1.flags.ignore_mandatory = True + rule_2.flags.ignore_mandatory = True + rule_3.flags.ignore_mandatory = True - rule_1.save() - rule_2.save() - rule_3.save() + rule_1.save() + rule_2.save() + rule_3.save()