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: unable to remove image from employee (backport #45793) #45813

Merged
merged 2 commits into from
Feb 10, 2025

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Feb 10, 2025

Current Premise

  1. Employee image is "fetched from" user doctype, with "Fetch on save if empty" checked, but this only works on server side. For example create an employee attach an image to it, don't link user_id just yet. Create a user, don't attach any image to it. Now from system console, link the user to the employee. The image won't be overwritten.
  2. "Fetch on save if empty" isn't meant to work client side, as soon as you set a value in a linked field, for example user_id, all fields of employee that depend on user, in this case image, should be updated regardless of if they are empty or not. This use-case explains why

The Problem

This, because the user is created after employee

Screen.Recording.2025-02-07.at.6.11.41.PM.mov

After

Screen.Recording.2025-02-07.at.6.36.08.PM.mov

Removing fetch from also solves the problem of not being able to remove image from employee, because it would be refetched as soon as it was removed.


This is an automatic backport of pull request #45793 done by Mergify.

fix: employee image disappears when newly created user_id is linked to employee

(cherry picked from commit 0207d2d)

# Conflicts:
#	erpnext/setup/doctype/employee/employee.json
Copy link
Contributor Author

mergify bot commented Feb 10, 2025

Cherry-pick of 0207d2d has failed:

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

You are currently cherry-picking commit 0207d2d7b6.
  (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)

Changes to be committed:
	modified:   erpnext/setup/doctype/employee/employee.py

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   erpnext/setup/doctype/employee/employee.json

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

@github-actions github-actions bot added the needs-tests This PR needs automated unit-tests. label Feb 10, 2025
@ruthra-kumar ruthra-kumar self-requested a review February 10, 2025 05:09
@ruthra-kumar ruthra-kumar self-assigned this Feb 10, 2025
@ruthra-kumar ruthra-kumar merged commit 9a5aa8e into version-15-hotfix Feb 10, 2025
11 checks passed
@ruthra-kumar ruthra-kumar deleted the mergify/bp/version-15-hotfix/pr-45793 branch February 10, 2025 05:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-tests This PR needs automated unit-tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants