Skip to content

Spare Parts: Get Started

This walkthrough configures one piece of equipment for automated spare-part picking on PM and verifies the result. It takes about 10 minutes on a demo instance.

Prerequisites

  • roots_hemms_spare_parts is installed
  • maintenance_stock (OCA) is installed — provides the Consumption picking type and allow_consumptions flag
  • You have at least one equipment record in :menuselection:Maintenance --> Equipment
  • You have at least one storable or consumable product in :menuselection:Inventory --> Products
  • A PM plan exists for the equipment (see the Preventive Maintenance get-started guide)

Step 1 — Enable consumptions on the equipment

  1. Open :menuselection:Maintenance --> Equipment and click an equipment record (e.g., "Vital Signs Monitor #3")
  2. Click the Spare Parts tab (added by this module)
  3. Scroll to the Stock & Consumptions section and set:

    Field Value
    Allow Consumptions Enabled
    Consumption Warehouse The warehouse whose Consumption picking type will be used (e.g., "BME Stores")
    Auto-create Picking on PM Enabled
  4. Click :guilabel:Save

Both toggles must be on

Setting Allow Consumptions without Auto-create Picking on PM means technicians can create pickings manually, but the PM cron will not create them automatically. Set both to get fully automatic drafts.

Consumption warehouse requirement

The selected warehouse must have a Consumption picking type configured (OCA creates one per warehouse automatically when maintenance_stock is installed). If the dropdown is empty, go to :menuselection:Inventory --> Configuration --> Warehouses and verify that the warehouse was set up after maintenance_stock was installed.

Step 2 — Add spare-part template lines

Still on the equipment form, in the Spare Parts tab:

  1. Click :guilabel:Add a line
  2. Fill in:

    Field Value Notes
    Product e.g., "ECG Cable (5-lead)" Storable or consumable only
    Default Qty 2 Typical consumption per PM visit
    PM Kinds "Calibration" Leave blank to include in all PM kinds
    Position / Note "Lead connector panel" Optional — helps technician locate the part
  3. Add a second line for a critical spare (e.g., "Lithium Battery CR2032"):

    • Product — a product already flagged as a critical spare
    • Default Qty1
    • PM Kinds — leave blank (used in any PM)
    • The Critical column automatically shows a red badge because the product has roots_is_critical_spare = True
  4. Click :guilabel:Save

On Hand column

The On Hand column shows live qty_available. A zero or negative value on a critical line will trigger a daily alert activity (see Workflows → Low-stock activity).

Step 3 — Mark critical spares

A spare line is automatically flagged as critical when either condition is true:

  • The product has roots_is_critical_spare = True (set on the product form under the HEMMS tab), or
  • The equipment's criticality colour is Red (Critical)

No manual toggle exists on the spare line itself — criticality is computed.

To mark a product as a critical spare:

  1. Open :menuselection:Inventory --> Products → click the product
  2. Open the HEMMS tab (or General Information tab — location depends on screen configuration)
  3. Enable Critical Spare
  4. Save

All spare lines for that product across all equipment will immediately show the red Critical badge.

Equipment-level criticality shortcut

If you set the equipment to Critical (red) in the Equipment Criticality module, every spare line on that equipment becomes critical automatically — regardless of the product's own flag.

Step 4 — Test: trigger a PM request and verify auto-picking

  1. Open :menuselection:Settings --> Technical --> Scheduled Actions
  2. Find "Maintenance: generate preventive maintenance requests"
  3. Click :guilabel:Run Manually

Now verify:

  1. Go to :menuselection:Maintenance --> Maintenance Requests
  2. Find the newly created PM request for your equipment
  3. Open it and look at the Stock Picking stat button (shows "1 Picking")
  4. Click the button — you should see a draft Consumption picking with:

    • SR No. — e.g., SR/2026/00001
    • Move lines matching the spare lines whose kind_ids matches the request's maintenance_kind_id (or all lines if no kind filter)
  5. Verify the Pending SR stat button on the request form shows 1

If no picking was created

Check the equipment's Allow Consumptions and Auto-create Picking on PM are both enabled, and that the Consumption Warehouse has a Consumption picking type. Also verify the spare-part template has at least one line.

What just happened

When the cron ran:

  1. OCA maintenance_plan cron created a maintenance.request with maintenance_plan_id set
  2. roots_hemms_spare_parts create() override on maintenance.request detected maintenance_plan_id + both flags enabled
  3. _roots_auto_create_spare_picking() filtered the template lines by maintenance_kind_id and created a draft stock.picking
  4. stock.picking.create() override assigned the next hemms.stock.request sequence number as roots_request_no

Next steps

  • Configuration — Product Thai names, SR sequence, PM kind filtering details
  • Workflows — What the technician does with the draft picking
  • Reporting — My Open Requests view and equipment stat buttons