Custom workflows and slash commands: Automate your Odoo queries

Turn your most frequent Odoo operations into instant slash commands. Execute complex queries, calculations, and reports with a single command.

Instant Results

No LLM processing needed for workflow execution

5 Step Types

MCP calls, compute, filter, sort, group_by

AI Formatting

Results formatted by your configured LLM

01.What are workflows?

Workflows are reusable automation scripts that you can execute with slash commands like /weekly-sales or /inventory-check. Instead of typing the same query every time, you create a workflow once and run it instantly whenever you need it.

Key benefit

Workflows execute instantly without LLM processing, giving you sub-second responses for frequent operations. The AI only formats the final results for readability.

How workflows work

User types: /weekly-sales
Chat API detects slash command
Load workflow from database
Execute workflow steps (query Odoo, calculate, filter)
Collect raw data
Pass to LLM for formatting
Stream formatted results to user

02.Creating your first workflow

You have two methods to create workflows: from a chat conversation (recommended) or manually via API.

Method 1: Create from chat (recommended)

1

Have a conversation about an Odoo operation

Ask the AI to perform a task you'll need repeatedly, like "Show me sales orders from this week with totals."

2

Click "Create Workflow" button

After the AI completes your query, click the "Create Workflow" button that appears in the chat.

3

Review generated workflow

The system analyzes your conversation and automatically generates workflow steps, including MCP calls and calculations.

4

Save and test

Give your workflow a slash command name (e.g., /weekly-sales) and save it. Test it immediately by typing your new command!

Method 2: Manual creation

For advanced users, you can create workflows manually by calling the workflows API:

POST /api/workflows
{
  "trigger_command": "/my-command",
  "display_name": "My Custom Workflow",
  "description": "Description of what this workflow does",
  "category": "custom",
  "workflow_steps": {
    "version": "1.0",
    "steps": [
      {
        "type": "mcp_call",
        "description": "Get sales orders",
        "tool": "execute_method",
        "params": {
          "model": "sale.order",
          "method": "search_read",
          "args": [[["state", "=", "sale"]]],
          "kwargs": {
            "fields": ["name", "partner_id", "amount_total"],
            "limit": 20
          }
        },
        "store_as": "orders"
      }
    ]
  },
  "is_public": false
}

03.Workflow step types

Workflows support five types of steps that you can chain together to create powerful automation scripts.

mcp_call

Execute an Odoo operation via MCP (Model Context Protocol)

Parameters:

  • tool: "execute_method"
  • params: { model, method, args, kwargs }
  • store_as: Variable name to store results

Example:

{
  "type": "mcp_call",
  "description": "Get sales orders from this week",
  "tool": "execute_method",
  "params": {
    "model": "sale.order",
    "method": "search_read",
    "args": [[["date_order", ">=", "{{week_start}}"]]],
    "kwargs": {
      "fields": ["name", "partner_id", "amount_total"],
      "order": "amount_total DESC"
    }
  },
  "store_as": "orders"
}

compute

Evaluate JavaScript expressions using workflow variables

Parameters:

  • expression: JavaScript code to evaluate
  • store_as: Variable name for result

Example:

{
  "type": "compute",
  "description": "Calculate total revenue",
  "expression": "{{orders}}.reduce((sum, o) => sum + o.amount_total, 0)",
  "store_as": "total_revenue"
}

filter

Filter array items based on a condition

Parameters:

  • source: Variable to filter
  • condition: Filter expression
  • store_as: Variable name for filtered results

Example:

{
  "type": "filter",
  "description": "Get orders over $1000",
  "source": "{{orders}}",
  "condition": "item.amount_total > 1000",
  "store_as": "large_orders"
}

sort

Sort array items by field value

Parameters:

  • source: Variable to sort
  • by: Field name to sort by
  • order: "ASC" or "DESC"
  • limit: Optional max items
  • store_as: Variable name for sorted results

Example:

{
  "type": "sort",
  "description": "Get top 10 customers by revenue",
  "source": "{{orders}}",
  "by": "amount_total",
  "order": "DESC",
  "limit": 10,
  "store_as": "top_orders"
}

group_by

Group array items by field and perform aggregations

Parameters:

  • source: Variable to group
  • key: Field name to group by
  • aggregate: { result_field: "sum(source_field)" }
  • store_as: Variable name for grouped results

Example:

{
  "type": "group_by",
  "description": "Sales by customer",
  "source": "{{orders}}",
  "key": "partner_id",
  "aggregate": {
    "total_revenue": "sum(amount_total)",
    "order_count": "count(id)"
  },
  "store_as": "customer_summary"
}

04.Context variables and arguments

Workflows can use context variables and user-provided arguments to make them dynamic and reusable.

Built-in context variables

VariableDescriptionExample Value
{{today}}Current date2025-01-11
{{week_start}}Monday of current week2025-01-06
{{month_start}}First day of current month2025-01-01
{{user_id}}Current user IDuuid-string
{{args}}User-provided arguments array["2025-01"]

Using arguments

Pass parameters to workflows by typing them after the slash command:

User input:

/sales-report 2025-01

In your workflow:

{
  "type": "mcp_call",
  "params": {
    "args": [[["create_date", ">=", "{{args[0]}}-01"]]]
  }
}

The LLM will also acknowledge: "Here's your sales report for 2025-01..."

05.Best practices and optimization

Follow these guidelines to create efficient, maintainable workflows that leverage automatic optimization features.

Automatic workflow parallelization

The system automatically detects independent workflow steps and executes them in parallel for faster results. Steps are parallelized when they don't depend on each other's variables.

Example:

If Step 1 fetches customers and Step 2 fetches products (neither uses variables from the other), both execute simultaneously - potentially cutting execution time in half.

Up to 3x speedup for workflows with parallel operations

Dynamic LLM formatting

Workflow results are automatically sent to your configured LLM for intelligent formatting. The AI presents data in the most appropriate format based on the content and your question.

What this means:

  • No need to hardcode format_response steps
  • Your chosen AI Persona influences the presentation style
  • Results adapt to the user's question context
  • Tables, lists, summaries chosen automatically

Workflow caching

Workflow results are cached per user for 1 hour with a 500-entry limit. Same command with same arguments returns instantly from cache.

Cache key includes:

  • User ID (isolated per user)
  • Workflow ID
  • Arguments hash

No cross-user data leakage - each user has their own isolated cache

Design guidelines

Do

  • Use context variables like {{today}} instead of hardcoded dates
  • Store intermediate results with descriptive variable names
  • Write clear step descriptions for debugging
  • Design independent steps to leverage automatic parallelization
  • Let the LLM handle formatting - focus on data retrieval logic
  • Test workflows with different argument values
  • Use compute/filter steps to minimize MCP calls

Don't

  • Hardcode dates that change (use variables instead)
  • Make excessive MCP calls when one query would suffice
  • Forget to test with edge cases and invalid arguments
  • Use generic variable names like "data" or "result"
  • Skip step descriptions (makes debugging harder)

Performance tips

Minimize Odoo queries

Fetch all needed data in one MCP call, then use compute/filter/sort steps to process it locally.

Use field limits

Only request the fields you need in kwargs.fields to reduce data transfer.

Set record limits

Add limit parameters to avoid fetching thousands of records when you only need top 10.

06.Troubleshooting

Workflow not executing

Your slash command doesn't trigger the workflow

Check these:

  • Command starts with / (e.g., /weekly-sales)
  • Workflow exists in database (check Dashboard → Workflows)
  • You have access (you're the owner or workflow is public)
  • No typos in command name

LLM formatting fails

Results display as raw JSON instead of formatted text

Possible causes:

  • LLM API key not configured (check Dashboard → Settings)
  • LLM API quota exceeded (check your provider dashboard)
  • Temporary LLM service disruption (raw data fallback is working)
  • Check chat logs for specific error messages

Context variable not working

Variables like {{today}} show as literal text

Solutions:

  • Check variable syntax: {{variable_name}} (double braces)
  • Ensure no extra spaces: {{ today }} won't work
  • Verify variable name spelling matches exactly
  • For nested data: {{orders[0].name}} or {{args[0]}}

Workflow takes too long

Execution times out or is very slow

Optimize by:

  • Adding limit to your Odoo queries (e.g., limit: 100)
  • Reducing requested fields in kwargs.fields
  • Using more specific filters in your args
  • Breaking complex operations into smaller workflows
  • Avoiding nested MCP calls (flatten your workflow)

Still having issues?

Check our general troubleshooting guide or contact support for help.

07.Managing your workflows

View, edit, and organize all your workflows from the dashboard.

Access the workflow manager

Go to /dashboard/workflows to manage your workflows.

Features available:

  • List all workflows - See your workflows plus public ones
  • Filter by category - Sales, inventory, finance, HR, or custom
  • Edit metadata - Change name, description, category, visibility
  • Delete workflows - Remove workflows you no longer need
  • View statistics - See execution count, last used date, step count

Categories

Sales

Sales orders, customers, revenue

Inventory

Stock, products, warehouses

Finance

Invoices, payments, accounts

HR

Employees, attendance, payroll

Custom

Your custom workflows

Next steps