From ce75e4e9a8207946683c98b8d57725db91ba36e7 Mon Sep 17 00:00:00 2001 From: Aysha Date: Wed, 11 Dec 2024 08:58:04 +0530 Subject: [PATCH] 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(