From 48edcbfb69f8556f8df2177b8370247dc545b887 Mon Sep 17 00:00:00 2001 From: Chillar Anand Date: Tue, 14 Sep 2021 12:00:34 +0530 Subject: [PATCH] fix(HR): Ignore invalid fields when updating employee details (#27456) (cherry picked from commit 95460d98186ea62873487faf3c04af19f1d2fb11) # Conflicts: # erpnext/hr/utils.py --- erpnext/hr/utils.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/erpnext/hr/utils.py b/erpnext/hr/utils.py index a2c45c0c0d3..e6f79e14f4f 100644 --- a/erpnext/hr/utils.py +++ b/erpnext/hr/utils.py @@ -186,11 +186,21 @@ def update_employee_work_history(employee, details, date=None, cancel=False): field = frappe.get_meta("Employee").get_field(item.fieldname) if not field: continue +<<<<<<< HEAD new_value = item.new if not cancel else item.current new_value = get_formatted_value(new_value, field.fieldtype) setattr(employee, item.fieldname, new_value) +======= + fieldtype = field.fieldtype + new_data = item.new if not cancel else item.current + if fieldtype == "Date" and new_data: + new_data = getdate(new_data) + elif fieldtype =="Datetime" and new_data: + new_data = get_datetime(new_data) + setattr(employee, item.fieldname, new_data) +>>>>>>> 95460d9818 (fix(HR): Ignore invalid fields when updating employee details (#27456)) if item.fieldname in ["department", "designation", "branch"]: internal_work_history[item.fieldname] = item.new