Repo comfac-hrms EntryPoints
Appearance
Repo:comfac-hrms/EntryPoints — Entry Points & Configuration
How This App Starts
Installation & Startup
Frappe apps are started by the Frappe Framework (via bench). The app itself doesn't have a traditional "main()" entry point. Instead:
- Bench loads the app via
hrms/__init__.py - Hooks (
hrms/hooks.py) register the app with Frappe - DocType definitions are loaded from JSON files
- Controllers (Python classes) are imported when needed
Key Commands
| Command | Purpose |
|---|---|
bench --site [site] install-app hrms |
Install HRMS on a site |
bench --site [site] migrate |
Run patches, sync DocTypes |
bench start |
Start development server |
bench build |
Compile frontend assets |
Main Config Files
hooks.py
Location: hrms/hooks.py
This is the most important file for understanding entry points. Key sections:
| Config Section | What It Controls |
|---|---|
app_name, required_apps |
App identity and dependencies |
doctype_js |
Client scripts attached to ERPNext DocTypes |
override_doctype_class |
Python class overrides (Employee, Timesheet, etc.) |
doc_events |
Server-side event handlers (validate, on_update, on_submit) |
scheduler_events |
Background jobs (hourly, daily, weekly, monthly) |
website_route_rules |
URL routing for web views |
modules.txt
Location: hrms/modules.txt
Lists the modules: HR and Payroll. Controls how DocTypes are organized in the Frappe desk.
patches.txt
Location: hrms/patches.txt
List of database migration scripts that run during bench migrate.
Environment Variables
Standard Frappe environment variables affect this app:
| Variable | Purpose |
|---|---|
FRAPPE_BENCH_ROOT |
Path to bench installation |
MARIADB_ROOT_PASSWORD |
Database credentials (Docker setups) |
SITE_NAME |
Default site for commands |
How to Verify It's Running Correctly
Health Checks
- Desk Access: Navigate to
/desk— HR module should appear in the sidebar - HR Module: Click "HR" — should see: Employee, Leave, Attendance, Expense Claims, etc.
- Payroll Module: Click "Payroll" — should see: Salary Slip, Payroll Entry, etc.
Log Locations
| Log Type | Location (Docker) | Location (Local) |
|---|---|---|
| Frappe web logs | docker logs [container] |
logs/web.log
|
| Scheduler logs | docker logs [worker] |
logs/worker.log
|
| Bench console | Terminal running bench start |
Terminal running bench start
|
What Healthy Startup Looks Like
- No import errors in logs
- HR and Payroll modules visible in desk sidebar
- DocTypes load without "Missing controller" errors
- Scheduled jobs registered (check
_rq_jobtable or RQ dashboard)
Request/Task Flow
Example: Submitting a Leave Application
- User Action: Clicks "Submit" on Leave Application form
- Client-Side: JavaScript validates fields (
leave_application.js) - API Call:
frappe.desk.form.saveendpoint called - Server-Side (Controller):
LeaveApplication.validate()runs - Server-Side (Hooks):
doc_eventsin hooks.py fire - Database: Document saved, status changed to "Open" or "Approved"
- Background Job: Email notification queued (if configured)
- Response: Success message returned to client
Example: Payroll Entry Processing
- User Action: Creates Payroll Entry, clicks "Create Salary Slips"
- Controller:
PayrollEntry.create_salary_slips()called - Background Job: Salary slip creation queued (hourly_long queue)
- Individual Slips: Each
SalarySlip.calculate_net_pay()runs - Accounting: Journal Entry created (if configured)
- Status Update: Payroll Entry status changes to "Submitted"
Integration Points
ERPNext Integration
- Expense Claims → Journal Entries (Accounting)
- Payroll → Bank Transactions (Payments)
- Employee → User (Access control)
- Timesheet → Projects (Billing)
Web Routes
/hrms— HRMS frontend (Vue.js SPA)/hr— Roster module- Job openings published via
website_generators
Related Pages
- Repo_comfac-hrms_Overview — Project overview
- Repo_comfac-hrms_DirectoryMap — Directory structure
- Repo_comfac-hrms_DataModel — DocTypes and data structures
- Repo_comfac-hrms_ExtensionPoints — Hooks and customization
- Repo_comfac-hrms_CommonEdits — Common edit recipes