Skip to content

Automation Integration Guide

๐ŸŽฏ Overview

Have you ever wished your Odoo system could automatically analyze data, generate reports, or perform intelligent actions whenever something happens or on a schedule? That's exactly what AI Automation does - it connects your AI assistants with Odoo's Automation Rules and Scheduled Actions, so AI can work for you automatically in the background.

Think of it like having a smart assistant that watches your system and takes action whenever you need it, without you having to ask. When a new lead comes in, AI can automatically analyze it. When an order is confirmed, AI can generate a summary. When data is updated, AI can validate it. Or, on a schedule, AI can generate daily reports, perform periodic data analysis, or run maintenance tasks. All automatically, all the time.

๐Ÿ’ก What Can AI Automation Do?

AI Automation opens up powerful possibilities for automating intelligent tasks:

Data Analysis & Enrichment

  • Automatically analyze new records and add insights
  • Enrich leads with additional information from your database
  • Calculate scores and ratings based on multiple factors
  • Identify patterns and trends in your data

Report Generation

  • Generate daily, weekly, or monthly reports automatically
  • Create summaries of important events
  • Compile data from multiple sources into readable formats
  • Send intelligent notifications with context

Data Quality & Validation

  • Validate new records before they're saved
  • Check for compliance issues automatically
  • Clean and standardize data
  • Flag potential problems for review

Smart Categorization

  • Automatically categorize records based on content
  • Tag records with relevant keywords
  • Route items to appropriate teams or departments
  • Prioritize tasks based on intelligent analysis

Workflow Automation

  • Trigger complex workflows based on AI analysis
  • Make decisions automatically when criteria are met
  • Update related records based on intelligent insights
  • Coordinate actions across multiple systems

๐Ÿ“‹ Prerequisites

Before you can use AI Automation, make sure you have:

  • โœ… AI Complete Suite installed and configured
  • โœ… base_automation module enabled (usually comes with Odoo)
  • โœ… At least one AI Assistant created and configured
  • โœ… AI Configuration set up with valid API key
  • โœ… Understanding of how Odoo Automation Rules and Scheduled Actions work

๐Ÿš€ Step 1: Understanding the Basics

What is an AI Action?

An AI Action is a special type of action you can use in Odoo Automation Rules and Scheduled Actions. Instead of just updating a field or sending an email, an AI Action lets you ask an AI assistant to do something intelligent with your data.

Key Differences from Regular Actions:

  • Regular Action: "Set field X to value Y" - simple, predefined
  • AI Action: "Analyze this record and suggest improvements" - intelligent, flexible

How It Works

When an automation rule or scheduled action with an AI Action triggers:

  1. System creates a new AI thread - Each automation execution gets its own conversation thread
  2. Records are tagged - Records can be included in the AI's context in two ways:

    • Manual tagging: Both Automation Rules and Scheduled Actions support manual record tagging using $model/id syntax in your prompt (e.g., $crm.lead/123)
    • Automatic tagging (Automation Rules only): All records that triggered the rule are automatically included in the AI's context, in addition to any manual tags you specify
  3. Your prompt is sent to AI - The AI receives your instructions along with the record data (if any)

  4. AI executes autonomously - The AI works in non-interactive mode, making decisions and taking actions without asking questions
  5. Results are applied - The AI can create records, update data, send messages, or perform any other actions using its tools

Key Difference:

  • Automation Rules are triggered by events (record creation, update, etc.) and automatically include the triggered records in the AI context (in addition to any manual tags)
  • Scheduled Actions run on a fixed schedule (daily, weekly, monthly) and don't have triggered records - you must manually tag records using $model/id syntax or instruct AI to search for records in your prompt

Non-Interactive Mode

When AI runs through automation, it works in non-interactive mode. This means:

  • โœ… AI makes decisions automatically based on available information
  • โœ… AI uses tools to gather data if needed, but doesn't ask you
  • โœ… AI completes tasks without waiting for confirmation
  • โŒ AI won't ask questions or request clarification
  • โŒ AI won't wait for your input

This is perfect for automation because the AI needs to work independently, just like any other automated action.

๐Ÿ› ๏ธ Step 2: Creating Your First AI Automation

Let's create a simple automation that automatically analyzes new sales leads. This will give you a hands-on understanding of how everything works.

Setting Up the Automation Rule

  1. Navigate to Automation Rules

    • Go to Settings โ†’ Technical โ†’ Automation โ†’ Automation Rules
    • Click Create
  2. Configure the Trigger

    • Name: "Auto-Analyze New Leads"
    • Model: crm.lead (or your lead model)
    • Trigger: "On Creation" (or "On Update" if you prefer)
    • Domain: Leave empty to trigger on all leads, or add conditions like [('type', '=', 'lead')]
  3. Add the AI Action

    • Scroll to the Actions section
    • Click Add a line
    • Action Type: Select "AI Action"
    • You'll now see new fields appear for AI configuration
  4. Configure the AI Action

    Now you need to tell the system which AI assistant to use and what you want it to do:

    • Select AI Assistant

      • AI Assistant: Choose the assistant you want to use (e.g., "Sales Analysis Assistant")
      • Make sure this assistant has access to the data sources it needs
    • Write Your Prompt

      • AI Prompt: This is where you describe what you want the AI to do
      • Be specific and clear about your expectations
      • Manual tagging: You can reference additional records using $model/id syntax in your prompt (e.g., $crm.lead/123)
      • Automatic tagging: The system automatically tags all triggered records in addition to any manual tags you specify

      Example Prompt:

      Analyze this lead and:
      1. Calculate a lead score based on company size, industry, and budget
      2. Add relevant tags based on the lead's industry and needs
      3. Suggest the best follow-up action (call, email, or meeting)
      4. Update the lead description with a summary of key insights
      

    • Configure Security (Optional)

      • Run as Superuser: Check this if the AI needs to access data beyond normal user permissions
      • Use this carefully - it bypasses security restrictions
      • Only enable if your AI needs to access restricted data
  5. Save the Rule

    • Click Save
    • Make sure the rule is Active

Note: When your automation triggers, the system automatically includes all triggered records in the AI's context. You can also manually tag additional records using $model/id syntax if needed.

Setting Up a Scheduled Action

For tasks that need to run on a schedule (daily reports, periodic analysis, etc.), you can use Scheduled Actions instead:

  1. Navigate to Scheduled Actions

    • Go to Settings โ†’ Technical โ†’ Automation โ†’ Scheduled Actions
    • Click Create
  2. Configure the Schedule

    • Name: "Daily Sales Report"
    • Model: sale.order (or the model you want to analyze)
    • Interval Number: 1
    • Interval Type: Days (or Weeks, Months, etc.)
    • Next Execution Date: Set when you want it to start
  3. Set Action Type to AI Action

    • Action Type: Select "AI Action" (instead of "Code")
    • You'll now see the same AI configuration fields as Automation Rules
  4. Configure the AI Action

    Now you need to tell the system which AI assistant to use and what you want it to do:

    • Select AI Assistant

      • AI Assistant: Choose the assistant you want to use (e.g., "Sales Reporting Assistant")
      • Make sure this assistant has access to the data sources it needs
    • Write Your Prompt

      • AI Prompt: This is where you describe what you want the AI to do
      • Be specific and clear about your expectations
      • Manual tagging required: Since there are no triggered records, you must manually tag records using $model/id syntax in your prompt (e.g., $sale.order/123) or instruct the AI to search for records using its tools

      Example Prompt:

      Search for all sale orders created yesterday and:
      1. Count total new orders
      2. Calculate total revenue
      3. Identify top 5 products by quantity
      4. List any orders over $10,000
      5. Note any unusual patterns or trends
      6. Generate a summary and post it to the Sales channel
      

    • Configure Security (Optional)

      • Run as Superuser: Check this if the AI needs to access data beyond normal user permissions
      • Use this carefully - it bypasses security restrictions
      • Only enable if your AI needs to access restricted data
  5. Save the Action

    • Click Save
    • Make sure the action is Active

Note: Since Scheduled Actions don't have triggered records, you must manually tag records using $model/id syntax in your prompt (e.g., $sale.order/123) or instruct the AI to search for records using its tools.

When to Use Each:

  • Automation Rules: Use when you want AI to act on specific events (new record created, record updated, etc.)
  • Scheduled Actions: Use when you want AI to run on a fixed schedule (daily reports, weekly analysis, monthly summaries, etc.)

๐Ÿ“ Step 3: Writing Effective Prompts

The quality of your automation depends heavily on how well you write your prompts. Here are some best practices:

Be Specific and Clear

โŒ Bad Prompt:

Analyze this lead.

โœ… Good Prompt:

Analyze this lead and:
1. Calculate a lead score from 0-100 based on:

   - Company size (larger = higher score)
   - Industry match with our target markets (+20 points)
   - Budget information availability (+10 points)
2. Add tags: "high-priority" if score > 70, "needs-followup" if score > 50
3. Update the lead description with: "Lead Score: [score]. Key factors: [list factors]"

Break Down Complex Tasks

If you want the AI to do multiple things, break it down into clear steps:

For this order:
1. Check if all line items are in stock
2. If any items are out of stock, create a purchase order for those items
3. Calculate the estimated delivery date based on stock availability
4. Update the order notes with delivery information
5. Send a message to the customer thread with the delivery estimate

Provide Context and Examples

Help the AI understand what you want by providing context:

This is a customer support ticket. Analyze the issue and:
1. Categorize it (Technical, Billing, Feature Request, Bug Report)
2. Assign a priority (High if contains words like "urgent" or "critical", Medium otherwise)
3. Suggest a response template based on the category
4. If it's a bug, create a linked bug report record

Use Conditional Logic

You can ask the AI to make decisions:

Analyze this invoice:
- If the amount is over $10,000, add tag "high-value" and notify the finance manager
- If payment is overdue by more than 30 days, mark as "urgent" and create a follow-up task
- If the customer has a good payment history, apply a 2% discount

๐Ÿ”’ Step 4: Security and Permissions

Understanding AI Permissions

By default, AI assistants respect the same permissions as the user who created the automation rule or scheduled action. This means:

  • AI can only access data the user has permission to view
  • AI can only modify records the user has permission to edit
  • AI respects all Odoo security rules and domain restrictions

When to Use Superuser Mode

The Run as Superuser option allows the AI to bypass security restrictions. Use this when:

  • โœ… The AI needs to access data from multiple companies
  • โœ… The AI needs to modify records the user normally can't edit
  • โœ… The automation should work regardless of who created the rule
  • โŒ Don't use it if you want to maintain strict security controls
  • โŒ Don't use it if the AI should respect user-level data access

Example Use Case: You want an automation that analyzes all leads across all companies and generates a company-wide report. The user who created the rule or scheduled action might only have access to their own company's leads, so you'd enable superuser mode to let the AI access all leads.

Best Practices for Security

  1. Start without superuser mode - Only enable it if you really need it
  2. Test thoroughly - Make sure the AI only does what you expect
  3. Monitor AI actions - Review what the AI does, especially in the beginning
  4. Use specific prompts - Clear prompts reduce the chance of unexpected actions
  5. Limit data sources - Only give the AI access to data sources it actually needs

๐Ÿงช Step 5: Testing Your Automation

Before relying on automation in production, test it thoroughly:

Testing Steps

  1. Create Test Records

    • Create a test record that matches your trigger conditions
    • Use data that's easy to identify (e.g., "TEST LEAD - DELETE ME")
  2. Trigger the Automation

    • Let the automation run (or manually trigger it if possible)
    • Wait a few moments for the AI to process
  3. Check the Results

    • Verify the AI thread was created: Settings โ†’ Technical โ†’ AI โ†’ Threads
    • Look for a thread with the same name as your automation rule or scheduled action
    • Check the thread messages to see what the AI did
    • Verify the actual changes to your records
  4. Review AI Actions

    • Check if records were created, updated, or modified as expected
    • Verify any messages were sent correctly
    • Ensure data quality is maintained
  5. Refine and Iterate

    • If results aren't perfect, adjust your prompt
    • Test again with different scenarios
    • Keep refining until you're satisfied

Common Testing Scenarios

Test with Different Data Types:

  • Test with complete data (all fields filled)
  • Test with minimal data (only required fields)
  • Test with edge cases (unusual values, special characters)

Test with Multiple Records:

  • Create multiple records that trigger simultaneously
  • Verify the AI handles all of them correctly
  • Check that each record gets appropriate treatment

Test Error Handling:

  • What happens if the AI can't complete the task?
  • What if required data is missing?
  • What if the AI encounters an error?

๐Ÿ“Š Step 6: Monitoring and Maintenance

Monitoring AI Automation

Keep an eye on your automations to ensure they're working correctly:

  1. Check AI Threads

    • Regularly review threads created by automation
    • Look for error messages or unexpected behavior
    • Verify AI responses match your expectations
  2. Review Record Changes

    • Spot-check records that were processed by automation
    • Ensure data quality is maintained
    • Look for patterns or issues
  3. Monitor Performance

    • Check how long automations take to complete
    • Watch for any slowdowns in your system
    • Ensure API usage stays within limits

Maintaining Your Automations

Regular Reviews:

  • Periodically review automation results
  • Update prompts based on changing business needs
  • Remove or update automations that are no longer relevant

Optimization:

  • Refine prompts to improve accuracy
  • Adjust triggers to reduce unnecessary executions
  • Optimize AI assistant configurations for better performance

Documentation:

  • Keep notes on what each automation does
  • Document any special considerations or edge cases
  • Update documentation when automations change

๐Ÿ’ก Real-World Examples

Example 1: Lead Enrichment

Goal: Automatically enrich new leads with additional information and scoring

Automation Setup:

  • Trigger: On Creation of crm.lead
  • AI Assistant: "Sales Analysis Assistant"
  • Prompt:
    Analyze this new lead and:
    1. Search our customer database for similar companies
    2. Calculate a lead score (0-100) based on:
       - Company size and industry
       - Budget information
       - Similarity to existing customers
    3. Add tags: "high-value" if score > 70, "qualified" if score > 50
    4. Update the lead description with key insights and the calculated score
    5. If score > 80, create a follow-up task for the sales team
    

Result: Every new lead automatically gets analyzed, scored, and tagged, saving the sales team hours of manual work.

Example 2: Daily Sales Report

Goal: Generate a daily summary of sales activities

Scheduled Action Setup:

  • Type: Scheduled Action
  • Schedule: Daily at 9:00 AM
  • Model: sale.order
  • AI Assistant: "Sales Reporting Assistant"
  • Prompt:
    Search for all sale orders created yesterday and:
    1. Count total new orders
    2. Calculate total revenue
    3. Identify top 5 products by quantity
    4. List any orders over $10,000
    5. Note any unusual patterns or trends
    6. Post a note in the Sales channel with the summary
    

Setup Instructions:

  1. Go to Settings โ†’ Technical โ†’ Automation โ†’ Scheduled Actions
  2. Create a new scheduled action
  3. Set Action Type to "AI Action"
  4. Configure the schedule (daily at 9 AM)
  5. Enter the prompt above
  6. Save and activate

Result: Sales team gets an intelligent daily summary automatically, highlighting important information and trends.

Example 3: Data Quality Check

Goal: Validate and clean customer data when records are updated

Automation Setup:

  • Trigger: On Update of res.partner
  • AI Assistant: "Data Quality Assistant"
  • Prompt:
    Review this customer record for data quality issues:
    1. Check if email format is valid
    2. Verify phone number format
    3. Check for duplicate records with similar names or emails
    4. Validate address completeness
    5. If issues found, add tag "needs-review" and create a task for data cleanup team
    6. If all checks pass, remove "needs-review" tag if present
    

Result: Customer data stays clean and validated automatically, reducing errors and improving data quality.

๐ŸŽฏ Best Practices

Prompt Design

  • Be specific: Clearly state what you want the AI to do
  • Provide context: Help the AI understand the business context
  • Break down tasks: Complex tasks should be broken into steps
  • Include examples: Show the AI what good output looks like
  • Test and refine: Iterate on your prompts based on results

Automation Design

  • Start simple: Begin with straightforward automations
  • Test thoroughly: Always test before relying on automation
  • Monitor closely: Watch automations closely at first
  • Document clearly: Keep notes on what each automation does
  • Review regularly: Periodically review and update automations

Security Considerations

  • Minimize superuser usage: Only use when absolutely necessary
  • Limit data access: Give AI only the data sources it needs
  • Test permissions: Verify AI respects security rules
  • Monitor actions: Review what AI does, especially initially
  • Keep prompts safe: Don't ask AI to do things that could cause problems

๐Ÿšจ Troubleshooting

AI Not Responding

  • Check if the AI assistant is active and properly configured
  • Verify the AI configuration has a valid API key
  • Check system logs for error messages
  • Ensure the automation rule or scheduled action is active
  • For Scheduled Actions, verify the next execution date is set correctly

Unexpected Results

  • Review the AI thread to see what the AI actually did
  • Check if your prompt was clear enough
  • Verify the AI has access to necessary data sources
  • Consider adding more context to your prompt

Performance Issues

  • Check if automations are running too frequently
  • Review API usage and rate limits
  • Consider optimizing prompts to be more efficient
  • Check system resources and database performance

Permission Errors

  • Verify the AI assistant has access to required data sources
  • Check if superuser mode is needed
  • Review user permissions for the automation creator
  • Ensure domain restrictions aren't blocking access

โœ… What's Next?

Now that you understand AI Automation, you can:

  1. Explore Use Cases: See real-world examples in Workflow Automation Use Cases
  2. Learn About AI Assistants: AI Assistants Guide
  3. Understand Data Sources: Data Sources Guide
  4. Configure Contexts: Contexts Guide

AI Automation transforms your Odoo system into an intelligent, self-managing platform. With careful planning and testing, you can automate complex tasks that would be impossible with traditional automation rules or scheduled actions.