Odoo icon

Odoo

Consume Odoo API

Opportunity → Create

AI-generated

Overview

This node allows you to create a new Opportunity in Odoo via its API. It is useful for automating the creation of sales opportunities, leads, or deals directly from your workflows. Common scenarios include integrating lead capture forms, CRM systems, or marketing tools with Odoo to automatically register new business opportunities.

Practical examples:

  • Automatically create an opportunity when a new lead is captured from a web form.
  • Add opportunities based on incoming emails or support tickets.
  • Integrate with other CRM or marketing platforms to sync potential deals into Odoo.

Properties

Name Meaning
Name The name/title of the opportunity. (Required)
Additional Fields A collection of optional fields to further describe the opportunity:
- Email: Email address associated with the opportunity.
- Expected Revenue: Anticipated revenue amount.
- Internal Notes: Any notes or description.
- Phone: Phone number related to the opportunity.
- Priority: Priority level; options are 1, 2, or 3.
- Probability: Probability percentage (0–100) indicating likelihood of closing the opportunity.

Output

The output will be a JSON object representing the newly created Opportunity in Odoo. The structure typically includes:

  • All fields sent in the request (e.g., name, email_from, expected_revenue, description, phone, priority, probability).
  • Additional fields as returned by Odoo, such as unique identifiers or timestamps, depending on Odoo's response.

Example output:

{
  "id": 123,
  "name": "New Business Deal",
  "email_from": "client@example.com",
  "expected_revenue": 5000,
  "description": "Initial contact made.",
  "phone": "+123456789",
  "priority": "2",
  "probability": 75,
  ...
}

Note: Actual output fields may vary depending on your Odoo configuration.

Dependencies

  • Odoo instance: You must have access to an Odoo server with the Opportunities module enabled.
  • API Credentials: Requires valid Odoo API credentials (URL, username, password, and database name) configured in n8n under the credential type odooApi.

Troubleshooting

Common issues:

  • Invalid credentials: If the provided Odoo credentials are incorrect, authentication will fail. Double-check the URL, username, password, and database name.
  • Missing required fields: The "Name" field is mandatory. Omitting it will result in an error.
  • Field value errors: Providing values outside allowed ranges (e.g., probability not between 0–100) may cause Odoo to reject the request.
  • Connection errors: Network issues or incorrect Odoo URL can prevent communication with the Odoo server.

Error messages:

  • "Credentials are not valid": Check your Odoo API credentials.
  • "Settings are not valid: ...": There may be a misconfiguration in your Odoo connection settings.
  • "error": "<message>" in output: Indicates a problem with the data sent or the Odoo server itself.

Links and References

Discussion