-
Notifications
You must be signed in to change notification settings - Fork 722
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: correct bank entry calculation with deductions and prevent multiple loan repayment deductions #2347
fix: correct bank entry calculation with deductions and prevent multiple loan repayment deductions #2347
Conversation
…ple loan repayment deductions
Can you add a test to ensure this doesn't break? |
added in previous PR: https://github.com/frappe/hrms/pull/2283/files#diff-cf6a883b62bb2053bba145dc2c7501552ea94f0b170188dd3a8d8ce1771028c1 |
The test is mostly of no use since it doesn't assert the loan amount deduction from salary slip total. Else, the above error could have been caught with the test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for being patient with the review 🙈 :D
…2347 fix: correct bank entry calculation with deductions and prevent multiple loan repayment deductions (backport #2347)
@Mergifyio backport version-15 |
✅ Backports have been created
|
Introduced via #2283 & #2324 and loan flow.
Issue:
total_loan_repayment
was being subtracted multiple times for each salary detail, leading to an incorrectsalary_slip_total
in the bank entry.Resolution:
get_salary_slip_details
function to ensuretotal_loan_repayment
is fetched only once per unique salary slip.make_bank_entry
function, we separated thetotal_loan_repayment
deduction from the main loop, ensuring it’s only subtracted once per salary slip, after calculating the total of earnings and deductions.