diff --git a/erpnext/hr/doctype/employee_transfer/employee_transfer.py b/erpnext/hr/doctype/employee_transfer/employee_transfer.py index d5422909a7..e11cedd883 100644 --- a/erpnext/hr/doctype/employee_transfer/employee_transfer.py +++ b/erpnext/hr/doctype/employee_transfer/employee_transfer.py @@ -25,10 +25,10 @@ class EmployeeTransfer(Document): new_employee = frappe.copy_doc(employee) new_employee.name = None new_employee.employee_number = None + new_employee = update_employee(new_employee, self.transfer_details, date=self.transfer_date) if self.company != self.new_company: new_employee.internal_work_history = [] - new_employee = update_employee(new_employee, self.transfer_details, date=self.transfer_date) - if self.new_company: + new_employee.date_of_joining = self.transfer_date new_employee.company = self.new_company #move user_id to new employee before insert if employee.user_id and not self.validate_user_in_details(): @@ -41,8 +41,9 @@ class EmployeeTransfer(Document): employee.db_set("status", "Left") else: employee = update_employee(employee, self.transfer_details, date=self.transfer_date) - if self.new_company: + if self.company != self.new_company: employee.company = self.new_company + new_employee.date_of_joining = self.transfer_date employee.save() def on_cancel(self): diff --git a/erpnext/hr/utils.py b/erpnext/hr/utils.py index 42cf0a9761..abbf302e5b 100644 --- a/erpnext/hr/utils.py +++ b/erpnext/hr/utils.py @@ -109,8 +109,9 @@ def update_employee(employee, details, date=None, cancel=False): def get_employee_fields_label(): fields = [] for df in frappe.get_meta("Employee").get("fields"): - if df.fieldtype in ["Data", "Date", "Datetime", "Float", "Int", - "Link", "Percent", "Select", "Small Text"] and df.fieldname not in ["lft", "rgt", "old_parent"]: + if df.fieldname in ["salutation", "user_id", "employee_number", "employment_type", + "holiday_list", "branch", "department", "designation", "grade", + "notice_number_of_days", "reports_to", "leave_policy", "company_email"]: fields.append({"value": df.fieldname, "label": df.label}) return fields