Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: set correct work experience during gratuity calculation #2460

Merged
merged 4 commits into from
Dec 12, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hrms/payroll/doctype/gratuity/gratuity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Member

@ruchamahabal ruchamahabal Dec 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
work_experience = flt(work_experience, precision=1)
work_experience = flt(work_experience, self.precision("current_work_experience"))

Instead of using a hardcoded precision let's set field level precision. You can set 1 as the default precision in core for this field. So when people want to have more precision, they can just customize field level precision and this calculation will get adjusted


if work_experience < rule.minimum_year_for_gratuity:
frappe.throw(
Expand Down
Loading