Skip to content

fix: correct salary slip naming when created via data import (backport #4980) - #4982

Open
mergify[bot] wants to merge 2 commits into
version-15-hotfixfrom
mergify/bp/version-15-hotfix/pr-4980
Open

fix: correct salary slip naming when created via data import (backport #4980)#4982
mergify[bot] wants to merge 2 commits into
version-15-hotfixfrom
mergify/bp/version-15-hotfix/pr-4980

Conversation

@mergify

@mergify mergify Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

What's the problem?

When a Salary Slip is created via Data Import, the name comes out wrong — for example Sal Slip/None/00001 instead of Sal Slip/HR-EMP-00010/00001.

Why does it happen?

default_series was set as an instance variable in __init__ using self.employee. At that point, Frappe hasn't set any field values yet, so self.employee is None.

Fix

Changed default_series from an instance variable to a @property. It now reads self.employee lazily — at the time autoname() actually calls it, the employee field is already set.

Test

  1. Create a Data Import for Salary Slip with an employee and period.
  2. Run the import.
  3. Verify the generated name follows the pattern 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).

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
@mergify
mergify Bot requested a review from ruchamahabal as a code owner July 21, 2026 14:01
@mergify mergify Bot added the conflicts label Jul 21, 2026
@mergify

mergify Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

Cherry-pick of bcc53de has failed:

On branch mergify/bp/version-15-hotfix/pr-4980
Your branch is up to date with 'origin/version-15-hotfix'.

You are currently cherry-picking commit bcc53de7f.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   hrms/payroll/doctype/salary_slip/salary_slip.py

no changes added to commit (use "git add" and/or "git commit -a")

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants