fix: correct salary slip naming when created via data import (backport #4980) - #4982
Open
mergify[bot] wants to merge 2 commits into
Open
fix: correct salary slip naming when created via data import (backport #4980)#4982mergify[bot] wants to merge 2 commits into
mergify[bot] wants to merge 2 commits into
Conversation
default_series was set in __init__ before field values were populated, causing employee to be None and generating names like Sal Slip/None/00001. Converting it to a property fixes the issue by reading employee lazily. (cherry picked from commit bcc53de) # Conflicts: # hrms/payroll/doctype/salary_slip/salary_slip.py
Contributor
Author
|
Cherry-pick of bcc53de has failed: To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's the problem?
When a Salary Slip is created via Data Import, the name comes out wrong — for example
Sal Slip/None/00001instead ofSal Slip/HR-EMP-00010/00001.Why does it happen?
default_serieswas set as an instance variable in__init__usingself.employee. At that point, Frappe hasn't set any field values yet, soself.employeeisNone.Fix
Changed
default_seriesfrom an instance variable to a@property. It now readsself.employeelazily — at the timeautoname()actually calls it, the employee field is already set.Test
Sal Slip/<employee>/<number>.Before:
Screen.Recording.2026-07-21.at.4.57.25.PM.mov
After:
Screen.Recording.2026-07-21.at.5.13.32.PM.mov
no-docs
This is an automatic backport of pull request #4980 done by [Mergify](https://mergify.com).