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 #45793

Merged
merged 1 commit into from
Feb 10, 2025

Conversation

asmitahase
Copy link
Contributor

@asmitahase asmitahase commented Feb 7, 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.

fix: employee image disappears when newly created user_id is linked to employee
@github-actions github-actions bot added the needs-tests This PR needs automated unit-tests. label Feb 7, 2025
@asmitahase asmitahase added backport version-14-hotfix backport to version 14 backport version-15-hotfix and removed needs-tests This PR needs automated unit-tests. labels Feb 7, 2025
@ruthra-kumar ruthra-kumar self-assigned this Feb 10, 2025
@ruthra-kumar ruthra-kumar self-requested a review February 10, 2025 04:31
@ruthra-kumar ruthra-kumar merged commit 95f6b58 into frappe:develop Feb 10, 2025
21 checks passed
ruthra-kumar added a commit that referenced this pull request Feb 10, 2025
…-45793

fix: unable to remove image from employee (backport #45793)
ruthra-kumar added a commit that referenced this pull request Feb 10, 2025
…-45793

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