Fix the disappears of image bug after uploading and saving the employee (#16217)
* Fix image disappears of image after uploading and saving the employee
* Fix the codacy issue
diff --git a/erpnext/hr/doctype/employee/employee.py b/erpnext/hr/doctype/employee/employee.py
index 81671c2..5d5bdd9 100755
--- a/erpnext/hr/doctype/employee/employee.py
+++ b/erpnext/hr/doctype/employee/employee.py
@@ -55,8 +55,8 @@
def validate_user_details(self):
data = frappe.db.get_value('User',
self.user_id, ['enabled', 'user_image'], as_dict=1)
-
- self.image = data.get("user_image")
+ if data.get("user_image"):
+ self.image = data.get("user_image")
self.validate_for_enabled_user_id(data.get("enabled", 0))
self.validate_duplicate_user_id()
@@ -336,4 +336,4 @@
.format(company=company, condition=condition), as_dict=1)
# return employee
- return employee
\ No newline at end of file
+ return employee