This page describes the requests sub-module in src/cluster_erp/modules/intranet/requests/. It is a generic engine for employee requests: the organisation defines request types with their own form fields, and employees file requests that move through submission, decision, and fulfilment (src/cluster_erp/modules/intranet/requests/services.py:1-2). Leave has its own sub-module; see leave.
Scope and source¶
- Defined in:
src/cluster_erp/modules/intranet/models.py(IntranetRequestType,IntranetRequest),requests/services.py,requests/routes.py,requests/schemas.py,requests/metadata.py, andrequests/seeds.py. - Count: 2 tables, 11 routes in
requests/routes.py, 5ActionMetaentries inrequests/metadata.py.
Fields¶
| Entity | Key fields | Source |
|---|---|---|
IntranetRequestType |
code, label, category, description, form_schema, approval_chain_code, sla_days, produces_document, allow_attachment, icon, sort_order, is_active |
src/cluster_erp/modules/intranet/models.py:841-879 |
IntranetRequest |
code, request_type_id, party_id, title, status, payload, attachment_id, approval_request_id, result_document_id, submitted_at, decided_at, decided_by, decision_note, due_at |
src/cluster_erp/modules/intranet/models.py:881-934 |
The categories are leave, advance, expense_claim, document_request, equipment, access, travel, and general (src/cluster_erp/modules/intranet/models.py:104-113). form_schema is a list of fields with a key, a label per language, a field type, and a required flag; the answers are stored in payload (src/cluster_erp/modules/intranet/requests/seeds.py:14-27). The module seeds six request types on start when their codes are missing: advance, expense_claim, document_request, equipment, access, and general (src/cluster_erp/modules/intranet/requests/seeds.py:10-136, src/cluster_erp/modules/intranet/module.py:97-131).
Statuses and actions¶
A request is draft, submitted, in_review, approved, rejected, cancelled, or fulfilled (src/cluster_erp/modules/intranet/models.py:114-122). The service allows these transitions (src/cluster_erp/modules/intranet/requests/services.py:48-54):
stateDiagram-v2 [*] --> draft draft --> submitted: submit submitted --> approved: approve in_review --> approved: approve submitted --> rejected: reject in_review --> rejected: reject approved --> fulfilled: fulfill draft --> cancelled: cancel submitted --> cancelled: cancel in_review --> cancelled: cancel
In prose: a request is drafted, submitted, decided, and, when approved, fulfilled. It can be cancelled before a decision. No transition in the service writes in_review.
| Action | Label | Condition in metadata | Source |
|---|---|---|---|
submit |
Submit | status is draft |
src/cluster_erp/modules/intranet/requests/metadata.py:212-218 |
approve |
Approve | status is submitted |
src/cluster_erp/modules/intranet/requests/metadata.py:219-225 |
reject |
Reject | status is submitted |
src/cluster_erp/modules/intranet/requests/metadata.py:226-232 |
fulfill |
Fulfill | status is approved |
src/cluster_erp/modules/intranet/requests/metadata.py:233-239 |
cancel |
Cancel | status is submitted |
src/cluster_erp/modules/intranet/requests/metadata.py:240-246 |
Rules¶
- Every field marked required in the type's
form_schemamust have a non-empty answer. The check runs on create, on update of the payload, and again on submit (src/cluster_erp/modules/intranet/requests/services.py:26-46,src/cluster_erp/modules/intranet/requests/services.py:224,src/cluster_erp/modules/intranet/requests/services.py:248,src/cluster_erp/modules/intranet/requests/services.py:281-287). - On submit, the service asks
GetApprovalChainForActionfor the resourceintranet_request. With a chain and a known actor it callsSubmitForApprovaland stores the approval request id (src/cluster_erp/modules/intranet/requests/services.py:289-309). - Approve and reject record the decision time, the decider, and an optional note. Fulfil can store a result document id (
src/cluster_erp/modules/intranet/requests/services.py:310-321). - Approve, reject, and fulfil notify the requester in-app and by e-mail with the i18n key
intranet.notif_request_plus the new status (src/cluster_erp/modules/intranet/requests/services.py:322-339). - The action route lets a caller act only on requests in their scope; Approve, Reject, and Fulfill also need
intranet_request.approve(src/cluster_erp/modules/intranet/requests/routes.py:181-203). - Creating a request for another person needs
intranet_request.read_all, and the named party must be an active employee (src/cluster_erp/modules/intranet/requests/routes.py:132-150). - A subscription to
ApprovalCompletedwas not found in the intranet package; decisions are recorded through the action route.
Routes¶
| Router | Paths | Permission | Source |
|---|---|---|---|
request_type_router |
/request-types list, create, read, update, delete |
intranet_request_type.* |
src/cluster_erp/modules/intranet/requests/routes.py:27, src/cluster_erp/modules/intranet/requests/routes.py:34-95 |
request_router |
/requests list, create, read, update, action, delete |
intranet_request.* |
src/cluster_erp/modules/intranet/requests/routes.py:28, src/cluster_erp/modules/intranet/requests/routes.py:98-213 |
Terms introduced¶
| Term | Code identifier | Definition | Turkish term | Source |
|---|---|---|---|---|
| request type | IntranetRequestType |
An organisation-defined kind of employee request with its own form fields. | Talep türü | src/cluster_erp/modules/intranet/models.py:841 |
| form schema | form_schema |
The list of fields a request type asks for. | Form şeması | src/cluster_erp/modules/intranet/models.py:841-879 |
Related pages¶
Verified against commit 92f8051 on 2026-11-13.