Employee lifecycle and HR records
Employee lifecycle and HR records provide the system of record for a worker from joining through exit. They connect the employee master to structured onboarding, job changes, benefits, separation work, and final settlement so that HR actions update related work, payroll, leave, and accounting records.
Employee master data
The Employee master is the central record for a worker. It holds the identity and work data used by attendance, leave, payroll, expenses, and other workforce services. HR can also record a health insurance provider and policy number against the employee; the provider is maintained as a separate HR record. Workforce management gives the wider view of this shared employee record.
The employee record also acts as the target of lifecycle actions. Onboarding can create it from an accepted applicant, while transfers and promotions apply approved changes to it. These actions preserve a dated internal work history for key work properties instead of treating each change as an isolated edit.
References: hrms/…/employee_master.py• L14-29 hrms/setup.py• L269-288 hrms/…/utils.py• L61-98
Lifecycle actions
Lifecycle actions are submitted HR records that apply a dated change to the employee master or coordinate work around the change. The main actions have different business effects, but they share a controlled record-and-submit pattern.
| Action | Business purpose | Result on the employee record |
|---|---|---|
| Onboarding | Move an accepted applicant into the workforce | Creates or links an active Employee record after required work is complete |
| Transfer | Move a worker between teams, branches, or companies | Updates work data and history, or closes the old record and creates a new employee ID |
| Promotion | Record a change in role or terms | Updates selected employee properties and can revise CTC |
| Property update | Capture a specific master-data change | Shows the current and new values as part of a transfer or promotion |
| Separation | Coordinate the worker’s exit | Runs an exit task plan and supports later final settlement |
| Full and final statement | Close financial and asset obligations | Collects payables, receivables, and asset recovery before payment |
Onboarding flow
Onboarding links an accepted Job Applicant and a submitted Job Offer to the future employee record. The form limits the offer choice to that state and can load activities from an onboarding template. When the onboarding record is submitted, the shared boarding controller creates a Project and Tasks, assigns work to users or roles, and tracks progress through the project.
Employee creation remains gated by the task plan. Each activity marked as required for employee creation must have a Task with status Completed or Cancelled; the form can also mark all onboarding tasks and the Project as completed when HR confirms the work is done. The completion action accepts POST requests only so that this write operation is not exposed through a read-style request. A submitted onboarding record without an Employee can then map to an active Employee record. The record exposes links to the Employee, Project, and related Tasks so that HR can move between the lifecycle record and its work.
The following flow shows how recruitment output becomes an employee record and an active onboarding plan.
flowchart LR
A[Accepted Job Applicant] --> B[Submitted Job Offer]
B --> C[Employee Onboarding]
T[Onboarding Template] --> C
C --> D[Project and assigned Tasks]
D --> E{Required tasks complete or cancelled?}
E -- No --> D
E -- Yes --> F[Active Employee master]
D --> G[Boarding status]
Onboarding status reflects project progress as Pending, In Process, or Completed. This makes the HR record and its task plan show the same stage. The linked applicant and offer move to an accepted state when the employee is inserted. See Recruitment and staffing for the upstream applicant and offer flow.
References: hrms/…/employee_onboarding.js• L4-14 hrms/…/employee_onboarding.js• L16-63 hrms/…/employee_onboarding.py• L49-100 hrms/…/employee_onboarding.py• L103-128 hrms/…/employee_onboarding.json• L31-76 hrms/…/employee_boarding_controller.py• L14-141
Transfer and promotion flow
Transfer and promotion records define a set of Employee properties that must change on a stated date. The shared property detail row records the field, current value, and new value. The form requires a transfer change set and stores promotion changes in the same property-history model. This gives HR a clear change set and gives the system enough information to reverse the change on cancellation.
The two actions differ in scope. A transfer can move the employee to a new company and can either keep the employee ID or create a new one while relieving the old record. A promotion changes work properties and can revise CTC when a revised value is supplied. Both actions update internal work history for changes such as department, designation, and branch.
flowchart LR
A[Active Employee] --> B{Lifecycle action}
B --> C[Employee Transfer]
B --> D[Employee Promotion]
C --> E[Property changes and work history]
D --> E
D --> F[Optional revised CTC]
E --> G[Updated Employee master]
F --> G
The action date cannot be in the future. A cancelled action restores the prior values and removes the work-history entry that it added. This keeps the employee master and its history aligned with the submitted lifecycle record.
References: hrms/…/employee_transfer.json• L23-112 hrms/…/employee_promotion.json• L24-119 hrms/…/employee_transfer.py• L13-99 hrms/…/employee_promotion.py• L13-64 hrms/…/utils.py• L61-163 hrms/…/employee_property_update.js• L1-209 hrms/…/employee_property_history.json• L7-44
Separation and exit work
Separation uses the same boarding model as onboarding, but it starts from an existing employee and an exit date. A separation template supplies the activities. Submission creates a Project and assigned Tasks so teams can complete exit work, while the record can also hold an exit interview summary.
The separation record keeps the employee’s company, department, designation, grade, and resignation date visible as read-only context. Its status moves through Pending, In Process, and Completed as the boarding work progresses. The separation project is tied to the employee’s holiday list. Task dates move past holidays, and project completion updates the separation boarding status. This makes separation a work plan rather than only a status change on the Employee master. Attendance and shift management and Leave management describe the workforce records that may need review during the exit period.
References: hrms/…/employee_separation.json• L28-154 hrms/…/employee_separation.py• L5-48 hrms/…/employee_separation_template.json• L18-68 hrms/…/employee_boarding_controller.py• L102-155 hrms/…/employee_boarding_controller.py• L178-199
Full-and-final processing
The Full and Final Statement is the financial close for a separated employee. It gathers amounts owed to the employee and amounts owed by the employee, then adds assets that must be returned or recovered. Its totals bring these parts together for settlement.
The statement draws from linked HR and finance records. Its payable side can include withheld salary, gratuity, expense claims, bonuses, and leave encashment. Its receivable side can include employee advances and loans when lending is installed. When HR refreshes the statement, employee advance rows follow the current outstanding balance, while rows already marked as settled remain unchanged. Asset rows come from recorded asset movements and require either return or cost recovery before submission. Loan-related close work also runs when the statement is submitted or cancelled.
flowchart LR
A[Relieving date] --> B[Full and Final Statement]
S[Salary and HR dues] --> B
R[Employee advances and loans] --> B
X[Asset movements] --> B
B --> C{All rows settled and assets resolved?}
C -- No --> B
C -- Yes --> D[Submit settlement]
D --> E[Journal entry and payment status]
The statement starts as Unpaid. A linked Journal Entry changes it to Paid when submitted and returns it to Unpaid when cancelled. Discarding the statement marks it as Cancelled. The statement also exposes the accounting link through Journal Entry Account rows. This link updates payment status on supported payable documents. Employee expenses and travel covers expense claims that can enter this close.
The settlement contract keeps source records aligned with the final statement. Repeated refreshes remove stale employee-advance rows, add new outstanding advances, update rows that are not settled, and preserve rows that HR already settled. Tests also cover asset recovery, journal-entry balancing, employee parties on accounting rows, loan and advance close behavior, and discard status.
References: hrms/…/full_and_final_statement.json• L34-200 hrms/…/full_and_final_statement.py• L47-146 hrms/…/full_and_final_statement.py• L148-254 hrms/…/full_and_final_statement.py• L256-380 hrms/…/full_and_final_statement.py• L383-455 hrms/…/test_full_and_final_statement.py• L24-207
Framework coordination
The lifecycle records use framework hooks to keep related records in step. The shared EmployeeBoardingController gives onboarding and separation the same project, task, assignment, holiday, progress, and cancellation behavior. Frappe document events then connect Employee, Project, and Task changes to these records.
The coordination has five main boundaries:
- Employee creation: an onboarding record validates required tasks before it maps to the Employee master.
- Work change: transfer and promotion write selected values and work history on submission, then reverse them on cancellation.
- Boarding progress: Project and Task events recalculate onboarding or separation status from project completion.
- Financial close: Journal Entry events update the Full and Final Statement and supported linked payables.
- Company finance setup: Company events provide the payroll payable and employee advance accounts used by HR finance flows, and clear company links when a company is removed.
The Employee override also keeps the employee identity model connected to recruitment, approver roles, resource updates, transfer cleanup, and configurable naming. These hooks are part of the lifecycle contract even though the user works mainly with the HR records.
References: hrms/…/employee_boarding_controller.py• L14-18 hrms/hooks.py• L213-227 hrms/…/employee_master.py• L14-29 hrms/…/employee_master.py• L90-120 hrms/…/company.py• L100-117 hrms/…/company.py• L171-186 hrms/…/company.py• L189-238 hrms/…/full_and_final_statement.py• L446-455
Change checklist
When these files or sections are changed, remember to consider these:
- Changes to onboarding or separation activities must preserve the shared Project, Task assignment, holiday-date, and boarding-status contract.
- Changes to the onboarding form or its write actions must preserve the accepted and submitted Job Offer boundary, the required-task gate before Employee mapping, and the POST-only completion action.
- Changes to Employee fields that can be changed by transfer or promotion must remain compatible with property detail values and work-history updates.
- Changes to Employee creation must preserve the link between Job Applicant, Job Offer, Employee Onboarding, and the Employee master.
- Changes to relieving data must keep Employee Separation and Full and Final Statement aligned, especially the required relieving date.
- Changes to Full and Final components or Journal Entry links must preserve settlement checks, the refresh of unsettled employee advance balances, loan close processing, and the
Paid/Unpaid/Cancelledstatus transitions. - Changes to Company account defaults or company cleanup must preserve the payroll payable and employee advance account links needed by HR finance flows, plus the removal of company links from HR and Payroll single records.
- Changes to health insurance fields must keep the provider link and policy-number dependency usable on the Employee master.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| An onboarding activity marked as required is not complete or cancelled | Employee creation is blocked | Complete or cancel each required Task before mapping the Employee |
| An onboarding record uses an offer that is not accepted and submitted | The form cannot select the offer as a valid onboarding source | Use an accepted Job Offer that has been submitted |
| A client calls the onboarding completion action with a non-POST request | The action is rejected and onboarding tasks are not completed | Use a POST request for the write action |
| A transfer or promotion date is in the future | Submission fails | Use an effective date on or before the current date |
| A transfer requests a new employee ID but that record still exists | Transfer cancellation is blocked | Remove the linked new Employee before cancelling the transfer |
| A Full and Final Statement has no relieving date | Outstanding amounts cannot be loaded or the statement cannot be submitted | Set the Employee relieving date first |
| A payable, receivable, or asset row remains unresolved | Final settlement submission fails | Set outstanding rows to settled and return or recover every allocated asset |
| Employee naming is not configured in HR Settings | Employee creation fails | Configure the Employee naming system before creating employee records |
| The default payroll payable account belongs to another company or uses a different currency | Company validation rejects the account | Select a leaf account for the same company and currency |
Key files
| File | Why to read it |
|---|---|
| hrms/…/employee_master.py | Shows how the Employee master connects lifecycle records to recruitment and framework events. |
| hrms/…/employee_boarding_controller.py | Defines the shared project and task model for onboarding and separation. |
| hrms/…/employee_onboarding.py | Shows the gate from accepted recruitment data to an active Employee record and the write-only completion action. |
| hrms/…/employee_onboarding.js | Shows how the onboarding form selects valid offers, loads activities, and exposes lifecycle actions. |
| hrms/…/employee_onboarding.json | Defines the onboarding record’s recruitment links, activity plan, dates, and status. |
| hrms/…/employee_transfer.py | Shows transfer scope, employee-ID replacement, and reversal behavior. |
| hrms/…/employee_transfer.json | Defines the transfer change set, company move, and optional new employee ID. |
| hrms/…/employee_promotion.py | Shows promotion changes and optional CTC revision. |
| hrms/…/employee_promotion.json | Defines the promotion property history and salary-change fields. |
| hrms/…/utils.py | Defines shared employee property and internal work-history updates. |
| hrms/…/employee_separation.py | Shows separation’s use of the shared boarding controller. |
| hrms/…/employee_separation.json | Defines separation activities, status, employee context, and exit interview data. |
| hrms/…/full_and_final_statement.py | Defines the financial, asset, employee-advance, loan, and accounting close for an employee exit. |
| hrms/…/full_and_final_statement.json | Defines the settlement’s payable, receivable, asset, total, status, and accounting links. |
| hrms/…/test_full_and_final_statement.py | Shows the settlement contract for asset recovery, employee advances, journal entries, and discard status. |
| hrms/setup.py | Defines the health insurance fields added to the Employee master. |
| hrms/hooks.py | Lists the document events that synchronize lifecycle records with projects, tasks, employees, and journal entries. |
| hrms/…/company.py | Connects company setup and cleanup to payroll payable, employee advance, and HR company links used by lifecycle finance flows. |