From 1964a5d2c040f9fd4288a809ff157e0b90b2162f Mon Sep 17 00:00:00 2001 From: Aysha Date: Thu, 28 Nov 2024 01:09:41 +0530 Subject: [PATCH 1/4] fix: set correct work experience for gratuity (cherry picked from commit a8a92ad4c237657c9ba47a5168c5fd1f3983186d) --- hrms/payroll/doctype/gratuity/gratuity.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hrms/payroll/doctype/gratuity/gratuity.py b/hrms/payroll/doctype/gratuity/gratuity.py index ea7d80db31..732e425a9d 100644 --- a/hrms/payroll/doctype/gratuity/gratuity.py +++ b/hrms/payroll/doctype/gratuity/gratuity.py @@ -159,7 +159,7 @@ def get_work_experience(self) -> float: if rule.method == "Round off Work Experience": work_experience = round(work_experience) else: - work_experience = floor(work_experience) + work_experience = flt(work_experience, precision=1) if work_experience < rule.minimum_year_for_gratuity: frappe.throw( From efab81149a268211b61219bf168e82a09963315c Mon Sep 17 00:00:00 2001 From: Aysha Date: Wed, 11 Dec 2024 08:58:04 +0530 Subject: [PATCH 2/4] fix: set field level precision for work experience field in gratuity (cherry picked from commit ce75e4e9a8207946683c98b8d57725db91ba36e7) # Conflicts: # hrms/payroll/doctype/gratuity/gratuity.json --- hrms/payroll/doctype/gratuity/gratuity.json | 10 ++++++++++ hrms/payroll/doctype/gratuity/gratuity.py | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/hrms/payroll/doctype/gratuity/gratuity.json b/hrms/payroll/doctype/gratuity/gratuity.json index 6c1927d029..ca0495acde 100644 --- a/hrms/payroll/doctype/gratuity/gratuity.json +++ b/hrms/payroll/doctype/gratuity/gratuity.json @@ -59,8 +59,14 @@ { "default": "0", "fieldname": "current_work_experience", +<<<<<<< HEAD "fieldtype": "Int", "label": "Current Work Experience" +======= + "fieldtype": "Float", + "label": "Current Work Experience", + "precision": "1" +>>>>>>> ce75e4e9 (fix: set field level precision for work experience field in gratuity) }, { "default": "0", @@ -199,7 +205,11 @@ "index_web_pages_for_search": 1, "is_submittable": 1, "links": [], +<<<<<<< HEAD "modified": "2024-03-15 02:50:10.282517", +======= + "modified": "2024-12-11 08:46:04.751908", +>>>>>>> ce75e4e9 (fix: set field level precision for work experience field in gratuity) "modified_by": "Administrator", "module": "Payroll", "name": "Gratuity", diff --git a/hrms/payroll/doctype/gratuity/gratuity.py b/hrms/payroll/doctype/gratuity/gratuity.py index 732e425a9d..312a6f9787 100644 --- a/hrms/payroll/doctype/gratuity/gratuity.py +++ b/hrms/payroll/doctype/gratuity/gratuity.py @@ -159,7 +159,7 @@ def get_work_experience(self) -> float: if rule.method == "Round off Work Experience": work_experience = round(work_experience) else: - work_experience = flt(work_experience, precision=1) + work_experience = flt(work_experience, self.precision("current_work_experience")) if work_experience < rule.minimum_year_for_gratuity: frappe.throw( From 5c58ad7a5285bf313bfe8bff18ca0d3b5b9185f2 Mon Sep 17 00:00:00 2001 From: Rucha Mahabal Date: Wed, 11 Dec 2024 21:04:24 +0530 Subject: [PATCH 3/4] chore: remove unused import (cherry picked from commit da17577dce9cfaf9d7b719680827c907f1672e96) --- hrms/payroll/doctype/gratuity/gratuity.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/hrms/payroll/doctype/gratuity/gratuity.py b/hrms/payroll/doctype/gratuity/gratuity.py index 312a6f9787..de25701a0d 100644 --- a/hrms/payroll/doctype/gratuity/gratuity.py +++ b/hrms/payroll/doctype/gratuity/gratuity.py @@ -1,9 +1,6 @@ # Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt - -from math import floor - import frappe from frappe import _, bold from frappe.query_builder.functions import Sum From 8c84f5a3f506040e8df28ab286720e70d526043d Mon Sep 17 00:00:00 2001 From: Rucha Mahabal Date: Tue, 17 Dec 2024 12:46:59 +0530 Subject: [PATCH 4/4] chore: fix conflicts --- hrms/payroll/doctype/gratuity/gratuity.json | 9 --------- 1 file changed, 9 deletions(-) diff --git a/hrms/payroll/doctype/gratuity/gratuity.json b/hrms/payroll/doctype/gratuity/gratuity.json index ca0495acde..9fdc123978 100644 --- a/hrms/payroll/doctype/gratuity/gratuity.json +++ b/hrms/payroll/doctype/gratuity/gratuity.json @@ -59,14 +59,9 @@ { "default": "0", "fieldname": "current_work_experience", -<<<<<<< HEAD - "fieldtype": "Int", - "label": "Current Work Experience" -======= "fieldtype": "Float", "label": "Current Work Experience", "precision": "1" ->>>>>>> ce75e4e9 (fix: set field level precision for work experience field in gratuity) }, { "default": "0", @@ -205,11 +200,7 @@ "index_web_pages_for_search": 1, "is_submittable": 1, "links": [], -<<<<<<< HEAD - "modified": "2024-03-15 02:50:10.282517", -======= "modified": "2024-12-11 08:46:04.751908", ->>>>>>> ce75e4e9 (fix: set field level precision for work experience field in gratuity) "modified_by": "Administrator", "module": "Payroll", "name": "Gratuity",