fix - Employee Transfer, Promotion (#14603)

This commit is contained in:
Ranjith Kurungadam 2018-06-20 12:42:58 +05:30 committed by Nabin Hait
parent a1bb94e59d
commit c1030a3958
2 changed files with 7 additions and 5 deletions

View File

@ -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):

View File

@ -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