Introducing a new way to review your PRs.

Read the announcement

frappe / hrms

Open Source HR and Payroll Software

View on GitHub

20 documents · Updated Nov 23, 2026

docs / platform-integration-and-operations

Platform integration and operations

Frappe HRMS is a Frappe application that adds HR and payroll capabilities to a site that also runs ERPNext. Its platform layer registers the app, adds shared HR data and access rules, connects HR actions to Frappe events and scheduled work, and carries site data forward as the product changes.

Application registration

HRMS registers itself as Frappe HR and depends on Frappe and ERPNext. The app exposes HR and Payroll as its main modules and opens at the HR setup workspace. Its desk assets and app-screen entry make the product available inside the Frappe site rather than as a separate service. (hrms/hooks.py• L1-21, hrms/modules.txt• L1-2, pyproject.toml• L1-9, pyproject.toml• L65-74)

The application also connects web routes to the HRMS and roster experiences. Job openings can create public website pages, while HRMS and roster paths route to their matching web applications. (hrms/hooks.py• L78-89)

Setup and configuration

Installation prepares the shared Frappe site for HR work. It creates HRMS fields on ERPNext records, adds standard records and roles, applies default settings, creates notification templates and an appointment letter template, and runs the data changes needed for the installed product version. Uninstallation removes HRMS-owned custom fields and company-specific fixtures. (hrms/setup.py• L15-38, hrms/setup.py• L435-525, hrms/setup.py• L528-588, hrms/setup.py• L625-658)

The setup process also defines the access boundary for employee self-service. It creates the Employee Self Service user type and grants it limited access to employee, leave, attendance, expense, payroll, tax, training, shift, and travel records. HR roles receive the cross-app access needed by HR workflows, such as project and task records. (hrms/setup.py• L707-755, hrms/setup.py• L950-980)

Site defaults

HRMS gives a new site usable defaults for common HR work. These defaults include leave types, employment types, expense claim types, applicant sources, offer terms, notification templates, HR settings, payroll settings, role profiles, and a default appointment letter template. They provide a starting point without replacing later site-specific configuration. (hrms/setup.py• L435-525, hrms/setup.py• L528-603, hrms/setup.py• L625-635)

The setup model is aware of optional apps and company regions. If the Lending app is present, payroll gains loan-related fields and Employee Self Service gains loan access. Each company's country can add regional fields and defaults when its country changes. (hrms/setup.py• L67-86, hrms/setup.py• L678-705, hrms/setup.py• L641-667, hrms/…/company.py• L12-18)

References: hrms/setup.py• L67-86 hrms/setup.py• L435-603 hrms/setup.py• L625-705 hrms/…/company.py• L12-18

Company configuration

Company records are the point where HRMS joins HR data with accounting and regional data. HRMS adds HR and payroll account links to companies, fills common payable accounts when possible, and checks that selected accounts belong to the company and use its currency. (hrms/setup.py• L109-158, hrms/…/company.py• L67-186)

When a company changes country, HRMS can load the matching regional defaults and salary components. If a country has no regional module, the shared setup remains in place. If regional setup fails, HRMS logs the error and stops the company change with a clear setup error. (hrms/…/company.py• L12-18, hrms/…/company.py• L41-51, hrms/…/company.py• L67-89)

When a company is removed, HRMS cleans company-scoped records that it marks as safe to remove and clears company links in HR and Payroll single settings. This keeps shared Frappe records from pointing to a deleted company. (hrms/hooks.py• L181-189, hrms/…/company.py• L189-238)

References: hrms/setup.py• L109-158 hrms/…/company.py• L12-18 hrms/…/company.py• L41-51 hrms/…/company.py• L67-89 hrms/…/company.py• L171-238

Frappe integration surface

HRMS uses Frappe extension points to make HR behavior part of normal document work. The integration surface combines whitelisted APIs, standard DocType replacements, document events, dashboards, permissions, routes, and scheduler jobs. This lets HRMS extend ERPNext records while keeping access checks and transaction rules in the Frappe model.

APIs and external clients

The API layer serves the employee portal, roster client, login flow, and selected external integrations. It returns user and employee context, HR settings, workflow-aware requests, leave and attendance data, expense and advance data, company values, files, form metadata, and permitted write fields. The attendance calendar resolves holidays across the employee's assigned holiday-list ranges for the requested period, so a change of holiday list within that period is reflected in the calendar. The roster API adds calendar reads, schedule assignment, and controlled shift changes. OAuth provider discovery and the login setting endpoint support authentication choices for the web clients. See API and external integration for the endpoint-level view. (hrms/…/__init__.py• L30-107, hrms/…/__init__.py• L139-176, hrms/…/__init__.py• L179-253, hrms/…/__init__.py• L345-512, hrms/…/__init__.py• L515-718, hrms/…/__init__.py• L725-858, hrms/…/oauth.py• L4-31, hrms/…/system_settings.py• L4-6, hrms/…/roster.py• L46-168, hrms/…/roster.py• L193-267)

These APIs use Frappe permissions as part of the contract. User-facing reads are scoped to the current employee or an approved relationship. Form metadata is limited to supported field types. Write actions check the related document permissions before changing shifts, files, or other records. Roster filters are limited to known employee and shift fields before they reach the data query. API methods are also required to use type annotations, and their source can be exposed through API discovery for clients that need to understand an open-source method. (hrms/…/__init__.py• L81-96, hrms/…/__init__.py• L256-283, hrms/…/__init__.py• L776-858, hrms/…/roster.py• L12-43, hrms/…/roster.py• L127-168, hrms/…/roster.py• L226-267, hrms/hooks.py• L415-421)

References: hrms/…/__init__.py• L30-107 hrms/…/__init__.py• L139-176 hrms/…/__init__.py• L179-253 hrms/…/__init__.py• L345-512 hrms/…/__init__.py• L515-718 hrms/…/__init__.py• L725-858 hrms/…/oauth.py• L4-31 hrms/…/system_settings.py• L4-6 hrms/…/roster.py• L12-43 hrms/…/holiday_list.py• L35-53 hrms/hooks.py• L415-421

Overrides and document events

HRMS extends ERPNext through two related paths. An override supplies HR-aware behavior for shared records such as Employee, Timesheet, Payment Entry, and Project. A document event reacts when a record is validated, updated, submitted, inserted, or deleted. Together they connect HR workflows to recruiting, onboarding, approvals, accounting, employee transfers, linked records, and live client refreshes. (hrms/hooks.py• L163-232, hrms/…/employee_master.py• L14-145, hrms/…/company.py• L12-18)

Employee integration also preserves the link from a hire to its recruiting path. Employee creation can validate linked onboarding, mark the related applicant and offer as accepted, and retain the related Job Applicant and Job Offer on the employee record. The v16 migration adds these links and fills the offer link for existing employees where a matching offer remains active. (hrms/…/employee_master.py• L31-111, hrms/…/set_job_offer_in_employee.py• L6-45)

Employee payment integration keeps HR payments within ERPNext accounting. It creates payment references for employee advances, expense claims, gratuity, and leave encashment, while carrying the correct outstanding amount and currency conversion into the payment flow. (hrms/…/employee_payment_entry.py• L20-29, hrms/…/employee_payment_entry.py• L75-152, hrms/…/employee_payment_entry.py• L231-320)

The same integration enriches Frappe navigation. HRMS adds related transactions and an attendance heatmap to dashboards for employees, projects, timesheets, holiday lists, and bank accounts. It also adds HR documents to global search and links HR accounting documents to ERPNext accounting features. (hrms/hooks.py• L324-353, hrms/…/dashboard_overrides.py• L7-117)

The Frappe extension lifecycle page describes these hooks and overrides in more detail, including desktop configuration, subscriptions, notifications, and shared utilities.

References: hrms/hooks.py• L163-232 hrms/hooks.py• L324-353 hrms/…/employee_master.py• L14-145 hrms/…/employee_payment_entry.py• L20-29 hrms/…/employee_payment_entry.py• L75-152 hrms/…/employee_payment_entry.py• L231-320 hrms/…/company.py• L12-18 hrms/…/set_job_offer_in_employee.py• L6-45 hrms/…/dashboard_overrides.py• L7-117

Scheduled operations

Scheduled work keeps HR data current without a user request. Frappe runs reminders and summaries at all, hourly, daily, weekly, and monthly intervals. Longer jobs process automatic attendance, shift creation, expired leave allocations, earned leave allocation, and leave encashment. (hrms/hooks.py• L258-285)

The schedules link operational maintenance with product workflows. For example, interview reminders, birthday notices, shift expiry, expired job openings, attendance processing, and payroll-related leave work continue after the original document action is complete. (hrms/hooks.py• L261-285)

References: hrms/hooks.py• L258-285

Regional and subscription behavior

HRMS keeps common HR behavior in the main application while allowing country and hosting context to change the site experience. Regional setup adds local fields and salary data, while subscription checks can control which ERPNext functions are visible on hosted Frappe HR sites.

Regional resolution

Regional behavior resolves from the company country or the site country. HRMS exposes a regional function decorator so a country-specific function can replace a common function when a regional override is registered. The current hook maps India-specific housing and tax calculations to the India module. (hrms/__init__.py• L18-54, hrms/hooks.py• L316-322)

This keeps the core HR and payroll flows shared across countries. A regional module changes only the rules and setup that need local treatment. Company updates trigger regional fixture setup, and app setup discovers regional custom fields for companies already on the site. (hrms/…/company.py• L12-18, hrms/setup.py• L67-80)

References: hrms/__init__.py• L18-54 hrms/hooks.py• L316-322 hrms/…/company.py• L12-18 hrms/setup.py• L67-80

Hosted access control

On hosted .frappehr.com sites, HRMS can update ERPNext workspace visibility, ERPNext roles, and the site logo after setup or subscription changes. The goal is to align the visible platform with the site's HRMS and ERPNext access. Non-hosted sites do not use this hosted subscription path. (hrms/hooks.py• L107-110, hrms/subscription_utils.py• L66-85)

The subscription helper determines ERPNext roles from ERPNext modules and DocType permissions, then excludes HRMS and standard roles. Subscription status comes from the Frappe Cloud service and uses a short request timeout. (hrms/subscription_utils.py• L86-130, hrms/subscription_utils.py• L133-180)

References: hrms/hooks.py• L107-110 hrms/subscription_utils.py• L66-85 hrms/subscription_utils.py• L86-130 hrms/subscription_utils.py• L133-180

Telemetry

HRMS telemetry measures product use at a site level. It records selected workflow events and first-use milestones so product teams can see whether a site moves from setup into regular HR, recruitment, performance, attendance, and payroll use. (hrms/telemetry.py• L23-55, hrms/telemetry.py• L132-157)

Telemetry avoids automated contexts such as install, migration, patch, test, and import runs. First-use events apply only during the first 30 days after install and use a local milestone record to prevent duplicates. Event properties are coarse where user-entered content could expose private text, such as attendance request reasons. (hrms/telemetry.py• L8-20, hrms/telemetry.py• L34-55, hrms/telemetry.py• L91-105)

The daily attendance pulse is a scheduled summary rather than a per-record event. It reports activity for the day that ended before the scheduler ran and does not send a summary for a site with no active employees. (hrms/telemetry.py• L216-257)

References: hrms/telemetry.py• L8-20 hrms/telemetry.py• L23-55 hrms/telemetry.py• L91-105 hrms/telemetry.py• L132-157 hrms/telemetry.py• L216-257

Data evolution

HRMS evolves the site through ordered patches. Patches run before or after model synchronization, and post-install changes also support upgrades from older HRMS and ERPNext versions. They update old fields and records so current workflows can read the same business data after a version change. (hrms/patches.txt• L1-56, hrms/setup.py• L638-675)

Recent v16 migrations show the main forms of data evolution. They add the Employee overview to existing sites, create the current appointment letter template, move appointment terms into the letter body, and fill missing employee email values on leave applications. They also normalize Job Offer status and existing site access defaults, preserve customized leave notifications during the notification refactor, and replace or remove obsolete print formats and PDF settings. These changes keep stored data and the visible HR workspace aligned with current workflows. (hrms/…/add_employee_overview_tab.py• L1-11, hrms/…/create_default_appointment_letter_template.py• L1-5, hrms/…/move_appointment_letter_terms_to_letter_body.py• L7-29, hrms/…/set_employee_email_in_leave_application.py• L6-47, hrms/…/set_draft_status_in_job_offer.py• L4-11, hrms/…/hide_org_chart_from_employees_on_existing_sites.py• L4-6, hrms/…/migrate_leave_notification_customizations.py• L54-81, hrms/…/delete_job_offer_print_format.py• L4-11, hrms/…/delete_old_salary_slip_print_formats.py• L11-29, hrms/…/reset_salary_slip_print_format_renderer.py• L6-11)

The migration path includes compatibility checks and cleanup. It can stop an unsupported Frappe and HRMS version pair, move or rename data fields, create replacement records, remove old workspaces, update permissions, and convert older workflow values. Setup also runs a defined post-install patch sequence with patch mode enabled so these changes are treated as data maintenance rather than normal user activity. (hrms/…/check_version_compatibility_with_frappe.py• L6-20, hrms/…/delete_old_workspaces.py• L4-15, hrms/…/update_performance_module_changes.py• L6-80, hrms/setup.py• L638-675)

Migration work must preserve both the data model and the Frappe site surface. A field change can affect forms, permissions, API results, reports, and linked records. Workspace, print format, notification, and role changes can affect how users find and access the same business functions. See Frappe extension lifecycle for the platform hooks that consume the current model, and API and external integration for the contracts exposed to clients.

References: hrms/patches.txt• L1-56 hrms/setup.py• L638-675 hrms/…/add_employee_overview_tab.py• L1-11 hrms/…/migrate_leave_notification_customizations.py• L54-148 hrms/…/move_appointment_letter_terms_to_letter_body.py• L7-65 hrms/…/set_employee_email_in_leave_application.py• L6-47 hrms/…/delete_old_salary_slip_print_formats.py• L11-29 hrms/…/reset_salary_slip_print_format_renderer.py• L6-11 hrms/…/check_version_compatibility_with_frappe.py• L6-20 hrms/…/delete_old_workspaces.py• L4-15 hrms/…/update_performance_module_changes.py• L6-80

Change checklist

When these files or sections are changed, remember to consider these:

  • When changing hrms/hooks.py, check the matching callable, document lifecycle event, scheduler interval, and any client or data contract that depends on it.
  • When changing custom fields or user types in hrms/setup.py, check uninstall cleanup, regional additions, optional Lending integration, and Employee Self Service access.
  • When changing an ERPNext DocType override, check whether the base class behavior and the related document events still compose correctly.
  • When changing a whitelisted API, check permission scope, current-employee rules, workflow-state fields, and the employee portal or roster client that consumes the response.
  • When changing employee payment integration, check the supported employee document types, outstanding amount rules, exchange-rate handling, and linked Employee Advance updates.
  • When changing telemetry events, keep install, migrate, patch, test, and import runs silent and keep event properties free of raw private text.
  • When changing a patch, keep its phase and order aligned with model synchronization and confirm that current hooks and APIs can read the migrated records.
  • When changing regional setup or overrides, check country resolution and the behavior for companies without a regional module.
  • When changing notification, print format, appointment letter, or workspace migrations, check both customized existing sites and the standard records created for new sites.
  • When changing API discovery or method typing settings, check that public methods remain discoverable without exposing private source or weakening permission checks.

Important failure modes

TriggerConsequenceGuard
HRMS and Frappe versions are on incompatible branchesThe update stops before it can apply an unsafe migrationThe version compatibility patch checks the major versions and raises a clear error (hrms/…/check_version_compatibility_with_frappe.py• L6-20)
A site changes company country and regional setup failsCompany save fails and local defaults may not be completeRegional setup catches the error, logs it, and raises a country-specific setup error (hrms/…/company.py• L41-51)
A client sends an unsupported roster filterThe request is rejected instead of allowing an uncontrolled queryRoster APIs allow only known employee and shift filter names (hrms/…/roster.py• L12-43)
A client changes a shift or file without the related permissionThe operation is denied before the record changesAPI actions check employee, document, and file permissions (hrms/…/__init__.py• L780-803, hrms/…/roster.py• L127-168)
Telemetry runs during a patch or migrationMaintenance actions could look like real product useTelemetry skips install, migrate, patch, test, and import contexts (hrms/telemetry.py• L12-20)
A company is deleted while HR records still link to itStale company links remain in HR data or single settingsCompany deletion removes configured company data and clears HR and Payroll single links (hrms/…/company.py• L189-238)
An existing Employee has a Job Applicant but no matching active Job OfferThe recruiting history stays incomplete on the employee recordThe migration only fills job_offer when a non-cancelled offer matches the applicant (hrms/…/set_job_offer_in_employee.py• L35-45)
A submitted Expense Claim has partial reimbursement but keeps the unpaid statusPayment views show the wrong claim state and can mislead the next payment actionThe v16 patch marks claims with partial reimbursement as Partially Paid (hrms/…/update_partially_paid_expense_claim_status.py• L4-17)
Employee payment references use the wrong outstanding amount or exchange rateA payment entry can overpay or underpay an employee claim or advanceEmployee payment integration derives the reference amount from the source document and checks the related account currency (hrms/…/employee_payment_entry.py• L75-152, hrms/…/employee_payment_entry.py• L231-320)
A customized leave notification is treated as the old standard templateAn upgrade can disable or replace a site's intended messageThe migration compares normalized content and clones customized notifications before removing unused defaults (hrms/…/migrate_leave_notification_customizations.py• L107-148)
An old print format is deleted without updating links or defaultsExisting records or site settings can point to a missing formatThe migration updates link values and default format settings before deletion (hrms/…/delete_old_salary_slip_print_formats.py• L11-29)
Appointment letter terms exist but the target letter body is emptyExisting letters lose their old terms in the new formatThe migration reads the legacy terms and writes an escaped letter body only when source data is present (hrms/…/move_appointment_letter_terms_to_letter_body.py• L7-65)

Key files

FileWhy to read it
hrms/hooks.pyThe central map of app registration, Frappe hooks, overrides, document events, schedules, accounting links, API discovery, and search behavior.
hrms/setup.pyThe site setup contract for custom fields, defaults, roles, permissions, optional Lending integration, and post-install patches.
hrms/…/__init__.pyThe shared API surface used by employee-facing clients and HR forms.
hrms/…/roster.pyThe integration boundary for roster calendars, schedule assignments, and shift changes.
hrms/…/employee_master.pyThe HR-aware Employee extension and its links to onboarding, recruiting, approvals, and live refresh.
hrms/…/employee_payment_entry.pyThe accounting bridge for payments tied to employee claims, advances, gratuity, and leave encashment.
hrms/…/company.pyThe company-level boundary for regional setup, salary defaults, account checks, and cleanup.
hrms/telemetry.pyThe rules for usage events, activation milestones, privacy limits, and daily attendance summaries.
hrms/subscription_utils.pyThe hosted-site link between subscription state and ERPNext workspace, role, and branding access.
hrms/patches.txtThe ordered migration phases and patch history for model and data evolution.
hrms/…/migrate_leave_notification_customizations.pyA focused example of preserving site-specific notification behavior during a standard-record refactor.
hrms/…/move_appointment_letter_terms_to_letter_body.pyA focused example of converting legacy child data into the current letter representation.
hrms/…/delete_old_salary_slip_print_formats.pyA focused example of replacing standard records while preserving links and defaults.
hrms/…/set_employee_email_in_leave_application.pyA focused example of a bounded backfill that preserves progress even when some source rows have no value.
hrms/setup.py#get_post_install_patchesThe post-install migration sequence applied during HRMS setup.
hrms/__init__.pyShared resource refresh and regional override resolution used by the platform layer.