def on_submit(self): employee = frappe.get_doc("Employee", self.employee) if self.create_new_employee_id: 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.new_company and self.company != self.new_company: new_employee.internal_work_history = [] 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(): new_employee.user_id = employee.user_id employee.db_set("user_id", "") new_employee.insert() self.db_set("new_employee_id", new_employee.name) #relieve the old employee employee.db_set("relieving_date", self.transfer_date) employee.db_set("status", "Left") else: employee = update_employee(employee, self.transfer_details, date=self.transfer_date) if self.new_company and self.company != self.new_company: employee.company = self.new_company employee.date_of_joining = self.transfer_date employee.save()
def on_submit(self): employee = frappe.get_doc("Employee", self.employee) if self.create_new_employee_id: 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.new_company and self.company != self.new_company: new_employee.internal_work_history = [] 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(): new_employee.user_id = employee.user_id employee.db_set("user_id", "") new_employee.insert() self.db_set("new_employee_id", new_employee.name) #relieve the old employee employee.db_set("relieving_date", self.transfer_date) employee.db_set("status", "Left") else: employee = update_employee(employee, self.transfer_details, date=self.transfer_date) if self.new_company and self.company != self.new_company: employee.company = self.new_company employee.date_of_joining = self.transfer_date employee.save()
def on_submit(self): employee = frappe.get_doc("Employee", self.employee) employee = update_employee( employee, self.employee_rejoin_detail, date=employee.date_of_joining) for row in employee.internal_work_history: row.to_date = employee.relieving_date employee.save() frappe.db.set_value("Employee", self.employee, 'date_of_joining', self.rejoin_date)
def on_cancel(self): employee = frappe.get_doc("Employee", self.employee) if self.create_new_employee_id: if self.new_employee_id: frappe.throw(_("Please delete the Employee <a href='#Form/Employee/{0}'>{0}</a>\ to cancel this document").format(self.new_employee_id)) #mark the employee as active employee.status = "Active" employee.relieving_date = '' else: employee = update_employee(employee, self.transfer_details, cancel=True) if self.new_company != self.company: employee.company = self.company employee.save()
def on_cancel(self): employee = frappe.get_doc("Employee", self.employee) if self.create_new_employee_id: if self.new_employee_id: frappe.throw( _("Please delete the Employee <a href='#Form/Employee/{0}'>{0}</a>\ to cancel this document").format(self.new_employee_id)) #mark the employee as active employee.status = "Active" employee.relieving_date = '' else: employee = update_employee(employee, self.transfer_details, cancel=True) if self.new_company != self.company: employee.company = self.company employee.save()
def on_cancel(self): employee = frappe.get_doc("Employee", self.employee) employee = update_employee( employee, self.employee_rejoin_detail, cancel=True) employee.save()
def on_submit(self): employee = frappe.get_doc("Employee", self.employee) employee = update_employee(employee, self.promotion_details, date=self.promotion_date) employee.save()
def on_cancel(self): employee = frappe.get_doc("Employee", self.employee) employee = update_employee(employee, self.promotion_details, cancel=True) employee.save()
def on_submit(self): employee = frappe.get_doc("Employee", self.employee) employee = update_employee(employee, self.promotion_details, date=self.promotion_date) employee.save()