AI Server Actions: Intelligent Automation for Odoo

Automatically update record fields using AI. Generate descriptions, summaries, and enrich content without writing code.

Automation
AI Update
Server Actions
Workflow

Key Features

Key points

  • • AI-Powered Field Updates: Select "Update with AI" instead of fixed values to let AI automatically fill content based on your prompt.

  • • Built-in Server Actions Integration: Works within Odoo's "Update Record" action type, no additional modules needed.

  • • Multiple Field Type Support: Compatible with Char, Text, Html, and other stored field types.

  • • Natural Language Prompts: Write simple requests like "Generate a professional summary" instead of complex code.

  • • Full Automation: Combine with Automation Rules to update records automatically when events occur.


Important Terminology

Key points

  • • Server Action: Automated action executed on Odoo server when trigger conditions are met.

  • • Value Type: Method of assigning values to fields - can be fixed value, Python code, or "Update with AI".

  • • Update with AI: Special mode allowing AI to automatically generate field content based on prompts.

  • • AI Update Prompt: Natural language instruction describing what content AI should generate.

  • • Stored Field: Field with data saved directly to database, required for AI updates.

  • • Action To Do: Type of action the server action will perform - must be "Update Record" to use AI.


Step-by-Step Usage

Key points

  • • Step 1 - Access Server Actions: Go to Settings → Technical → Automation → Server Actions. Enable Developer Mode if Technical menu is not visible.

  • • Step 2 - Create or Edit Action: Create new or open existing server action. Select the target model (e.g., res.partner, sale.order).

  • • Step 3 - Configure Update Record: Set "Action To Do" to "Update Record". Choose target field in "Fields to Update" section.

  • • Step 4 - Select Update with AI: At "Value Type", choose "Update with AI". Interface will display "AI Update Prompt" input field.

  • • Step 5 - Write Prompt: Enter clear instructions like "Write a professional summary for this customer" or "Generate a concise note describing the issue".

  • • Step 6 - Save and Test: Save configuration. Test on sample records to verify results before applying to production automation.


Real-World Use Cases

Key points

  • • Auto-Generate Product Descriptions: When creating new products, AI automatically generates marketing descriptions based on name and attributes.

  • • Summarize Customer Requests: When receiving contact forms or emails, AI creates concise summaries for staff to quickly understand issues.

  • • Enrich Partner Information: Automatically generate internal notes about customers based on transaction history and interactions.

  • • Classify and Tag Content: AI reads ticket/lead content and automatically fills appropriate category or priority fields.

  • • Generate Email Content: Create professional email content based on templates and record information.

  • • Standardize Data: Automatically format and standardize text fields according to company standards.


Effective Prompt Writing Tips

Key points

  • • Be Specific: Instead of "Write something", use "Write a short professional summary of the customer request in 2-3 sentences".

  • • Define Style: Add requirements like "in a professional tone", "keep it concise", "use friendly language".

  • • Set Clear Limits: "Use maximum 100 words", "Return a single sentence", "Keep under 50 characters".

  • • Start with Simple Text Fields: Experiment with Char, Text fields before applying to more complex fields.

  • • Test on Real Data: Run action on sample records, review results, adjust prompt accordingly.

  • • Separate Multiple Goals: If updating multiple fields with different logic, create separate server actions.


Conditions and Limitations

Key points

  • • Stored Fields Only: Field must be stored in database. Non-stored computed fields will be blocked with "not stored" error.

  • • Requires Update Record Type: Only works when "Action To Do" is "Update Record", not applicable to other action types.

  • • Write Permissions Required: Action must run in context with permissions to update target records.

  • • Depends on ai_fields Module: ai_server_actions module requires ai_fields module to be installed and active.

  • • Results Depend on Prompt Quality: Unclear prompts will produce incorrect or overly generic results.


Common Troubleshooting

Key points

  • • "Update with AI" Not Visible: Check that ai_server_actions and ai_fields modules are installed, ensure you're in Update Record mode.

  • • Error "field can not be computed with AI": Selected field is not a stored field. Choose different field or modify field definition.

  • • AI Results Not as Expected: Write more specific prompts, add length/style requirements, retest on sample records.

  • • Action Runs But No Update: Check trigger conditions, verify correct target record, check write permissions.

  • • Content Too Long or Short: Add explicit limits to prompt like "maximum 100 words" or "at least 3 sentences".


Best Practices

Key points

  • • Start with Description Fields: Use AI for notes, descriptions, summaries before applying to critical data.

  • • Avoid Sensitive Data: Don't use AI directly for financial or legal data without additional validation layers.

  • • Keep Prompts Short and Clear: Good prompts are typically short, have specific goals, and clear output constraints.

  • • Test Thoroughly Before Deployment: Run tests in staging environment with sample data before production use.

  • • Monitor and Optimize: Track AI results, collect feedback, adjust prompts to improve accuracy.

  • • Prepare Prompt Templates: Create library of standard prompts for each business process type for reuse.