From a8a92ad4c237657c9ba47a5168c5fd1f3983186d Mon Sep 17 00:00:00 2001 From: Aysha Date: Thu, 28 Nov 2024 01:09:41 +0530 Subject: [PATCH 1/3] fix: set correct work experience for gratuity --- 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 ce75e4e9a8207946683c98b8d57725db91ba36e7 Mon Sep 17 00:00:00 2001 From: Aysha Date: Wed, 11 Dec 2024 08:58:04 +0530 Subject: [PATCH 2/3] fix: set field level precision for work experience field in gratuity --- hrms/payroll/doctype/gratuity/gratuity.json | 5 +++-- hrms/payroll/doctype/gratuity/gratuity.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/hrms/payroll/doctype/gratuity/gratuity.json b/hrms/payroll/doctype/gratuity/gratuity.json index 5da6c87c81..68d772f782 100644 --- a/hrms/payroll/doctype/gratuity/gratuity.json +++ b/hrms/payroll/doctype/gratuity/gratuity.json @@ -60,7 +60,8 @@ "default": "0", "fieldname": "current_work_experience", "fieldtype": "Float", - "label": "Current Work Experience" + "label": "Current Work Experience", + "precision": "1" }, { "default": "0", @@ -199,7 +200,7 @@ "index_web_pages_for_search": 1, "is_submittable": 1, "links": [], - "modified": "2024-10-25 15:33:11.549493", + "modified": "2024-12-11 08:46:04.751908", "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 da17577dce9cfaf9d7b719680827c907f1672e96 Mon Sep 17 00:00:00 2001 From: Rucha Mahabal Date: Wed, 11 Dec 2024 21:04:24 +0530 Subject: [PATCH 3/3] chore: remove unused import --- 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