Spare Parts: Configuration¶
This page covers every configurable aspect of the Spare Parts module, from products to sequences.
Products¶
Adding a Thai product name¶
roots_hemms_spare_parts adds the field roots_name_th (Thai name) to product.template. Entering a Thai name allows bilingual display and makes the product searchable by Thai text.
- Open :menuselection:
Inventory --> Products→ click the product - In the product name field at the top, the English name is the standard
namefield - Scroll to the HEMMS tab (or look for the Thai Name field on the General Information tab)
- Enter the Thai product name in Thai Name (ชื่อสินค้า TH), e.g.:
สายนำสัญญาณ ECG 5 ขั้ว - Save
Search works in both languages
The display_name search on product.template has been extended to include roots_name_th. Users who type Thai text in the product search bar on a spare-line form will get matching results.
Flagging a product as a critical spare¶
Critical spares are parts whose absence could delay life-critical equipment maintenance. Once flagged, every spare line for this product on any equipment shows a red Critical badge — and the daily cron will schedule an alert activity if the product drops to zero stock.
- Open the product form
- Open the HEMMS tab
- Enable Critical Spare (
roots_is_critical_spare) - Save
Computed flag — no override needed
You don't need to set anything on the spare line itself. The roots_is_critical field on hemms.equipment.spare.line is a stored computed field that re-evaluates whenever either the product flag or the equipment's criticality colour changes.
Recommended critical-spare candidates¶
| Product category | Why critical |
|---|---|
| Defibrillator pads / batteries | Direct life-support use in resuscitation |
| Ventilator breathing circuits | Single-patient consumable, hard to substitute |
| Infusion pump administration sets | High-volume, no equivalent substitution |
| Pulse oximeter probes (neonatal) | Specialized — not shared with adult wards |
| ECG electrodes for stress-test systems | Required for every calibration |
Equipment settings¶
allow_consumptions¶
Field: maintenance.equipment.allow_consumptions (added by OCA maintenance_stock)
Where to set: Equipment form → Spare Parts tab → Allow Consumptions toggle
Effect: Makes the Stock Pickings smart button appear on the equipment form and on maintenance requests. Without this flag, no pickings can be linked to this equipment's requests — auto-picking will silently skip even if the other flags are set.
roots_auto_generate_picking¶
Field: maintenance.equipment.roots_auto_generate_picking (added by this module)
Where to set: Equipment form → Spare Parts tab → Auto-create Picking on PM
Effect: When a PM-generated request is created (maintenance_plan_id is set), roots_hemms_spare_parts will automatically create a draft Consumption picking from the spare-line template. Does nothing for corrective requests (those without a maintenance_plan_id).
Visibility: This field is only visible to users with the stock.group_stock_user group. Non-inventory users will not see the toggle.
default_consumption_warehouse_id¶
Field: maintenance.equipment.default_consumption_warehouse_id (added by OCA maintenance_stock)
Where to set: Equipment form → Spare Parts tab → Consumption Warehouse
Effect: Determines which warehouse's Consumption picking type is used when creating auto-pickings. The picking type defines:
- Source location — where stock is pulled from (typically the main storeroom)
- Destination location — where consumed parts "go" (typically a virtual consumption / scrap location)
One warehouse per equipment
Each equipment can only have one consumption warehouse. If your hospital has multiple storerooms (e.g., main BME store + OR satellite store), assign the warehouse that physically supplies the ward where the equipment lives.
Stock Request sequence¶
What the sequence does¶
Every stock.picking linked to a maintenance.request is assigned a sequential reference number (roots_request_no) at creation, using the ir.sequence code hemms.stock.request. The default format is:
Examples: SR/2026/00001, SR/2026/00042, SR/2027/00001 (resets yearly).
Finding and customising the sequence¶
- Open :menuselection:
Settings --> Technical --> Sequences(Technical menu requires developer mode) - Search for "HEMMS Stock Request" or filter by Code =
hemms.stock.request - Open the sequence record
Configurable fields:
| Field | Default | Notes |
|---|---|---|
| Prefix | SR/%(year)s/ | Change SR to any prefix your hospital uses |
| Padding | 5 | Leading-zero padding (5 → 00001) |
| Sequence Size | (auto) | Maximum digits before overflow |
| Implementation | standard | no_gap is available if audit-gap prevention is required |
| Reset Frequency | Yearly | Can be changed to Monthly or Never |
Don't change the Code field
The sequence code hemms.stock.request is referenced in Python. Changing it will break auto-assignment of SR numbers. Change Prefix and Padding instead.
Retroactive renumbering
Odoo sequences don't retroactively renumber existing records. If you change the prefix mid-year, old SRs keep their old numbers — the new prefix applies only to pickings created after the change.
PM Kind filtering¶
How kind_ids on spare lines works¶
Each hemms.equipment.spare.line has a kind_ids Many2many field linking to maintenance.kind. This controls which lines are included when an auto-picking is created for a PM request:
Spare line kind_ids | Result |
|---|---|
| Empty (no kinds set) | Line is included in every auto-picking, regardless of the request's maintenance kind |
| One or more kinds set | Line is included only if the request's maintenance_kind_id is in the line's kind_ids |
Example: a Vital Signs Monitor with 3 kinds of spares¶
| Product | PM Kinds | Included for Calibration? | Included for General PM? | Included for Safety Inspection? |
|---|---|---|---|---|
| ECG lead set | (blank) | Yes | Yes | Yes |
| Calibration adapter | Calibration | Yes | No | No |
| Battery CR2032 | Calibration, Safety Inspection | Yes | No | Yes |
| Cleaning wipes | General PM | No | Yes | No |
Setting kind filters on a spare line¶
- Open the equipment form → Spare Parts tab
- Click the spare line to edit it
- In PM Kinds, select the kinds where this part is consumed:
The 3 seeded kinds are always available:
- General Preventive Maintenance (
roots_hemms_pm.kind_general_pm) - Calibration (
roots_hemms_pm.kind_calibration) - Safety Inspection (
roots_hemms_pm.kind_safety_inspection)
Any custom kind added via :menuselection:Maintenance --> Configuration --> Maintenance Kinds appears in the dropdown automatically.
- Leave PM Kinds empty to include the line in every auto-picking.
Corrective requests and kind filtering¶
Kind filtering applies only to auto-pickings created by the PM cron. When a technician manually creates a picking for a corrective request, all spare lines are visible — the technician selects what they need from the full product catalogue.
Security¶
The module inherits ACLs from:
- OCA
maintenance_stock— Maintenance User can read pickings; Maintenance Manager can write - Odoo
stock— Inventory User / Manager controls who can validate pickings
New ACLs added by this module:
| Model | Group | Access |
|---|---|---|
hemms.equipment.spare.line | Maintenance User | Read |
hemms.equipment.spare.line | Maintenance Manager | Read, Write, Create, Delete |