Skip to content

FSM Extensions

Field Service Management modules for automation, calendar sync, and event integrations.

Module Overview

Module Technical Name Version Description
FSM Automation jdx_field_service_automation 15.0.0.0 Auto-create FSM orders from delivery
FSM Calendar Sync jdx_fsm_calendar 15.0.1.0.0 Sync FSM orders to Google Calendar
AWS Gateway jdx_aws_gateway 15.0.1.0.0 Send Odoo events to AWS API Gateway

FSM Automation

Field Value
Technical Name jdx_field_service_automation
Version 15.0.0.0
Category Field Service
Dependencies fieldservice, sale, stock

Overview

Automatically creates Field Service Orders when delivery orders are validated. Links FSM orders to sales orders and deliveries for complete traceability.

Workflow

flowchart LR
    A[Sale Order] --> B[Delivery Order]
    B --> C{Validate}
    C --> D[FSM Order Created]
    D --> E[Schedule Install]
    E --> F[Complete & Sign]

Auto-creation Trigger

When a delivery order is validated (button_validate()):

# On stock.picking.button_validate():
if sale_order exists:
    create FSM Order with:
        - partner_id from sale order
        - picking_id = current delivery
        - type = 'Install'

FSM Order Fields Added

Field Type Description
picking_id Many2one Link to delivery order
partner_id Many2one Customer (direct, not via location)
partner_* Related Customer contact fields (phone, mobile, email)
picking_product_info Html Table of delivered products with dimensions

Product Info Table

The picking_product_info field displays delivered products:

Column Description
Product Product name
Quantity Delivered quantity
Width Dimension width (mm)
Height Dimension height (mm)
Location Installation location

Stock Picking Fields

Field Type Description
field_service_ids One2many Linked FSM orders

Usage

  1. Confirm Sale Order (creates delivery)
  2. Process and Validate delivery order
  3. FSM Order auto-created with "Install" type
  4. Schedule installation with technician
  5. Complete FSM order and capture signature

Installation

docker compose exec odoo odoo \
  -i jdx_field_service_automation \
  --stop-after-init -d DATABASE_NAME

Module Structure

jdx_field_service_automation/
├── __manifest__.py
├── __init__.py
├── models/
│   ├── __init__.py
│   ├── fsm_order.py          # FSM order extensions
│   └── stock_picking.py      # Delivery validation trigger
└── views/
    ├── fsm_order_views.xml
    └── stock_picking_views.xml

FSM Calendar Sync

Field Value
Technical Name jdx_fsm_calendar
Version 15.0.1.0.0
Category Field Service
Dependencies fieldservice, google_calendar
Python Dependencies google-api-python-client

Overview

Automatically syncs FSM Order schedules to a shared Google Calendar, allowing dispatchers and technicians to view scheduled jobs in their calendar apps.

Features

  • Automatic Sync - Sync when FSM Order is created/updated
  • Shared Calendar - Use a company-wide Google Calendar
  • Configurable Sync User - Specify which user's OAuth credentials to use
  • Multi-company Support - Configure per company
  • Manual Sync Button - Force sync from FSM Order form

Configuration

  1. Go to Settings → General Settings → FSM Calendar Sync
  2. Enable sync
  3. Set the shared Google Calendar ID
  4. Select the sync user (must have Google Calendar connected in Odoo)

Calendar ID

To find your Google Calendar ID:

  1. Open Google Calendar
  2. Go to calendar Settings (gear icon)
  3. Click on the calendar name
  4. Scroll to "Integrate calendar"
  5. Copy the Calendar ID (format: xxx@group.calendar.google.com)

Sync Workflow

sequenceDiagram
    participant User
    participant Odoo
    participant Google

    User->>Odoo: Create/Update FSM Order
    Odoo->>Odoo: Check sync enabled
    Odoo->>Google: Create/Update Calendar Event
    Google-->>Odoo: Event ID
    Odoo->>Odoo: Store Google Event ID

    Note over User,Google: Technicians see job in calendar

Event Details

Calendar events include:

Field Source
Title FSM Order name
Start Time Scheduled date start
End Time Scheduled date end
Location Customer address
Description FSM Order instructions

Manual Sync

To manually sync a single FSM order:

  1. Open FSM Order
  2. Click Sync to Calendar button
  3. Verify event appears in Google Calendar

Module Structure

jdx_fsm_calendar/
├── __manifest__.py
├── __init__.py
├── models/
│   ├── __init__.py
│   ├── res_config_settings.py
│   └── fsm_order.py
├── views/
│   ├── res_config_settings_views.xml
│   └── fsm_order_views.xml
└── security/
    └── ir.model.access.csv

AWS Gateway

Field Value
Technical Name jdx_aws_gateway
Version 15.0.1.0.0
Category Technical
Dependencies base

Overview

Sends Odoo business events to AWS API Gateway for external system integration. Supports sale orders, invoices, purchase orders, and FSM orders.

Features

  • Event Publishing - Send business events to AWS API Gateway
  • Retry Logic - Exponential backoff for failed requests
  • Structured Logging - Detailed logging for debugging
  • Multiple Event Types - Support for various Odoo models

Configuration

Configure in Settings → Technical → System Parameters:

Parameter Default Description
aws_gateway.enabled false Enable/disable event sending
aws_gateway.base_url - AWS API Gateway endpoint URL
aws_gateway.api_key - API Key for authentication (optional)
aws_gateway.timeout 5.0 Request timeout in seconds

Supported Events

Event Type Trigger Payload
sale_order_confirmed Sale order confirmed Order details, lines
invoice_posted Invoice validated Invoice details, lines
purchase_order_confirmed PO confirmed PO details, lines
fsm_order_completed FSM order completed FSM details, signature

Usage

Call from server actions or automated actions:

# In base_automation Python code
env['aws.gateway.event'].send(records, event_type='sale_order_confirmed')

API Gateway Setup

  1. Create AWS API Gateway REST API
  2. Create resource and POST method
  3. Configure Lambda integration or direct service integration
  4. Deploy API and note the endpoint URL
  5. (Optional) Create API Key for authentication

Request Format

Events are sent as JSON POST requests:

{
    "event_type": "sale_order_confirmed",
    "timestamp": "2024-03-15T14:30:00Z",
    "source": "odoo",
    "data": {
        "id": 123,
        "name": "SO0001",
        "partner_id": 456,
        "amount_total": 1500.00,
        "lines": [...]
    }
}

Retry Logic

Failed requests are retried with exponential backoff:

Attempt Delay
1 Immediate
2 1 second
3 2 seconds
4 4 seconds

After 4 failed attempts, the event is logged and skipped.

Module Structure

jdx_aws_gateway/
├── __manifest__.py
├── __init__.py
├── models/
│   ├── __init__.py
│   └── aws_gateway_event.py
└── data/
    └── ir_config_parameter.xml

Installation

# Install FSM Calendar Sync
docker compose exec odoo pip install google-api-python-client
docker compose exec odoo odoo \
  -i jdx_fsm_calendar \
  --stop-after-init -d DATABASE_NAME

# Install AWS Gateway
docker compose exec odoo odoo \
  -i jdx_aws_gateway \
  --stop-after-init -d DATABASE_NAME

Troubleshooting

FSM Calendar Not Syncing

  1. Verify google_calendar module is installed
  2. Check sync user has valid Google OAuth connection
  3. Verify Calendar ID is correct
  4. Check Odoo logs for Google API errors

AWS Gateway Events Not Sending

  1. Verify aws_gateway.enabled is set to true
  2. Check aws_gateway.base_url is correct
  3. Verify API Key if required
  4. Check Odoo logs for HTTP errors

Google Calendar Permission Errors

  1. Ensure sync user granted calendar permissions
  2. Verify calendar is shared with sync user
  3. Re-authenticate Google connection in Odoo