DRIMS Architecture
Contents
DRIMS Architecture#
This guide helps developers understand how DRIMS fits together so they can extend it effectively.
When You Need This#
Use this guide if you need to:
Add custom fields to DRIMS models
Create new alert types
Extend approval workflows
Integrate DRIMS with external systems
Build country-specific extensions
If you just need to configure DRIMS (warehouses, alerts, approvals), see DRIMS Configuration Guide instead. Most customization doesn't require code.
Mental Model#
DRIMS manages disaster relief through five interconnected workflows, all tied to a specific disaster incident:
graph TB
subgraph "Disaster Response"
INC[Incident]
end
subgraph "Supply Chain"
DON[Donations] --> WH[Warehouse Stock]
WH --> DSP[Dispatches]
DSP --> RET[Returns]
RET --> WH
end
subgraph "Coordination"
REQ[Requests] --> DSP
ALR[Alerts] -.-> WH
ALR -.-> REQ
end
INC --> DON
INC --> REQ
INC --> ALR
Key concepts:
Everything links to an Incident - Donations, requests, dispatches, and alerts all reference a specific disaster event
Requests drive dispatches - Field staff submit requests, approvers approve, warehouses fulfill
Alerts monitor health - Automated checks flag low stock, SLA breaches, and expiring items
Stock flows through Odoo - DRIMS extends
stock.pickingandstock.warehouse, not replaces them
Core Entities#
DRIMS introduces these models (all prefixed spp.drims.*):
Model |
Purpose |
Source |
|---|---|---|
|
Track incoming relief supplies |
|
|
Field requests for relief supplies |
|
|
Items returned from distribution |
|
|
Automated monitoring alerts |
|
|
Deployed staff tracking |
DRIMS also extends these existing models:
Model |
Extensions Added |
Source |
|---|---|---|
|
KPI fields, relationships |
|
|
DRIMS flags, tier, area |
|
|
Incident, POD, beneficiaries |
|
|
Area/warehouse assignments |
Workflows#
Donation Flow#
stateDiagram-v2
[*] --> announced
announced --> received: Mark Received
announced --> cancelled: Cancel
received --> inspected: Inspect
received --> cancelled: Cancel
inspected --> stocked: Stock
inspected --> rejected: Reject
stocked --> [*]
cancelled --> [*]
rejected --> [*]
Donations create stock.picking records of type donation_receipt when stocked.
Request & Approval Flow#
Requests use spp.approval.mixin for approval state, plus a separate fulfillment state:
stateDiagram-v2
state "Approval" as approval {
[*] --> draft
draft --> pending: Submit
pending --> approved: Approve
pending --> rejected: Reject
pending --> revision: Request changes
revision --> pending: Re-submit
}
state "Fulfillment" as fulfillment {
approved --> allocated: Assign warehouse
allocated --> dispatched: Ship items
dispatched --> delivered: Confirm POD
}
Key insight: Approval and fulfillment are tracked separately. A request can be approved but not yet dispatched.
Dispatch Flow#
Dispatches are stock.picking records with drims_type='request_dispatch'. DRIMS adds:
date_departed/date_arrivedfor transit trackingPOD (Proof of Delivery) fields for confirmation
beneficiary_countfor reporting
Extension Patterns#
Adding Fields to DRIMS Models#
Use standard Odoo inheritance:
from odoo import models, fields
class DrimsRequestExtension(models.Model):
_inherit = "spp.drims.request"
local_approval_required = fields.Boolean(
string="Requires Local Approval",
help="Check if this request needs local government sign-off"
)
Creating Custom Alert Types#
Add a vocabulary code for your alert type
Implement a check method
Register a cron job
See Extending DRIMS for complete examples with tests.
Adding KPIs to Incidents#
Extend spp.hazard.incident with computed fields:
class HazardIncidentKPI(models.Model):
_inherit = "spp.hazard.incident"
avg_response_hours = fields.Float(
compute="_compute_avg_response_hours",
store=True,
)
@api.depends("drims_request_ids.picking_ids.date_departed")
def _compute_avg_response_hours(self):
# Calculate average time from request to first dispatch
...
Module Dependencies#
graph LR
subgraph "Required"
HAZ[spp_hazard]
AREA[spp_area]
VOC[spp_vocabulary]
APR[spp_approval]
STOCK[stock]
end
subgraph "Optional"
SVC[spp_service_points]
CEL[spp_cel_domain]
end
DRIMS[spp_drims]
HAZ --> DRIMS
AREA --> DRIMS
VOC --> DRIMS
APR --> DRIMS
STOCK --> DRIMS
SVC -.-> DRIMS
CEL -.-> DRIMS
Key dependencies:
spp_hazard - Provides incident model that DRIMS extends
spp_area - Geographic hierarchy for request destinations and user scoping
spp_vocabulary - Controlled vocabularies for priorities, donor types, clusters
spp_approval - Approval workflow mixin used by requests
stock - Odoo's inventory system, extended for DRIMS operations
Security Model#
DRIMS uses spp_security patterns:
Group |
Access |
|---|---|
DRIMS Viewer |
Read all |
DRIMS Field Officer |
Create requests, confirm deliveries (scoped by area) |
DRIMS Warehouse Staff |
Manage inventory, process donations/dispatches (scoped by warehouse) |
DRIMS Request Approver |
Approve/reject requests |
DRIMS Manager |
Full access |
Access is scoped by:
Geographic area - Users see only requests/dispatches for their assigned areas
Warehouse - Warehouse staff see only their assigned warehouses
Record rules use drims_area_ids and drims_warehouse_ids on res.users.
Source Files#
Area |
Path |
|---|---|
Models |
|
Security |
|
Vocabularies |
|
Views |
See Also#
Extending DRIMS - Step-by-step extension examples with tests
DRIMS Configuration Guide - Configuration without code
spp_drims/README.md - Module overview
openspp.org