Skip to content

feat(odoo): add dynamic model prop to support all Odoo models#20271

Closed
NicolasStuff wants to merge 6 commits intoPipedreamHQ:masterfrom
NicolasStuff:fix/odoo-model-prop
Closed

feat(odoo): add dynamic model prop to support all Odoo models#20271
NicolasStuff wants to merge 6 commits intoPipedreamHQ:masterfrom
NicolasStuff:fix/odoo-model-prop

Conversation

@NicolasStuff
Copy link
Copy Markdown
Contributor

@NicolasStuff NicolasStuff commented Mar 13, 2026

Summary

The Odoo component currently has "res.partner" hardcoded in makeRequest(), which limits all operations (create, update, search & read) to Contacts only. This was flagged in the original spec (#15359) which explicitly required a model prop, but the implementer hardcoded res.partner instead.

This PR adds a model prop to each action, allowing users to work with any Odoo model — CRM leads (crm.lead), sales orders (sale.order), invoices (account.move), and more.

Changes

  • odoo.app.mjs: Added model propDefinition, updated makeRequest(model, method, filter, args) signature, updated all helper methods (getFields, searchAndReadRecords, createRecord, updateRecord, readRecord, getFieldProps) to accept model as first parameter
  • create-record.mjs: Added model prop, passes it to createRecord() and getFieldProps()
  • search-read-records.mjs: Added model prop, passes it to searchAndReadRecords()
  • update-record.mjs: Added model prop, passes it to updateRecord(), getFieldProps(), and getRecordIdOptions()

Backward Compatibility

The model prop defaults to "res.partner", so existing users will not be affected.

Related

Summary by CodeRabbit

  • New Features

    • Added model selection for Odoo actions so users can specify which Odoo model to operate on.
    • Create, search/read, and update actions now accept a model input and use it for fields, lookups, and requests.
  • Updates

    • Action metadata versions updated to 0.1.0 across Odoo components.
    • Odoo component package version bumped to 0.1.1.

Currently the Odoo component has 'res.partner' hardcoded in makeRequest(),
limiting all operations (create, update, search_read) to Contacts only.

This adds a 'model' prop to each action, allowing users to work with any
Odoo model (CRM leads, sales orders, invoices, etc.). Defaults to
'res.partner' for backward compatibility.

Resolves the original requirement from PipedreamHQ#15359 which specified a model prop.
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
pipedream-docs-redirect-do-not-edit Ignored Ignored Mar 20, 2026 4:24pm

Request Review

@pipedream-component-development
Copy link
Copy Markdown
Collaborator

Thank you so much for submitting this! We've added it to our backlog to review, and our team has been notified.

@pipedream-component-development
Copy link
Copy Markdown
Collaborator

Thanks for submitting this PR! When we review PRs, we follow the Pipedream component guidelines. If you're not familiar, here's a quick checklist:

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 13, 2026

Walkthrough

Adds a required public model prop across the Odoo app and actions; core app methods now accept model as the first parameter and forward it to Odoo API calls, replacing previously hard-coded model usage and updating action flows to pass model into app methods.

Changes

Cohort / File(s) Summary
Core App Module
components/odoo/odoo.app.mjs
Added model to propDefinitions (default "res.partner"). Updated signatures to accept model first for makeRequest, getFieldProps, getFields, searchAndReadRecords, readRecord, createRecord, updateRecord. Replaced hard-coded model usage with the model parameter in API calls.
Create Record Action
components/odoo/actions/create-record/create-record.mjs
Bumped action version to "0.1.0". Added public model prop (propDefinition: [odoo, "model"], reloadProps: true). additionalProps() now calls this.odoo.getFieldProps(this.model). run() passes model into odoo.createRecord(model, data) and exports response as before.
Search & Read Action
components/odoo/actions/search-read-records/search-read-records.mjs
Bumped version to "0.1.0". Added model prop (propDefinition: [odoo, "model"]). run() now calls this.odoo.searchAndReadRecords(this.model, parseObject(this.filter), args), preserving filter handling.
Update Record Action
components/odoo/actions/update-record/update-record.mjs
Bumped version to "0.1.0". Added model prop (propDefinition: [odoo, "model"], reloadProps: true). getFieldProps now called as getFieldProps(this.model, { update: true }). Record lookup and odoo.updateRecord calls now include model as the first argument.
Package Manifest
components/odoo/package.json
Bumped package version from 0.1.0 to 0.1.1.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Action as Action Handler
    participant App as Odoo App
    participant API as Odoo API

    User->>Action: Select model & execute action
    Action->>App: getFieldProps(model)
    App->>API: fields_get for model
    API-->>App: field definitions
    App-->>Action: field props

    Action->>App: createRecord/searchAndReadRecords/updateRecord(model, data)
    App->>API: execute_kw(model, method, ...)
    API-->>App: result
    App-->>Action: response
    Action-->>User: result
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding a dynamic model prop to the Odoo component to support all models instead of just hardcoded 'res.partner'.
Description check ✅ Passed The PR description is comprehensive, covering the problem (hardcoded model), solution (adding model prop to actions), implementation details, backward compatibility, and related issues. It follows the repository template with a 'WHY' section included.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@luancazarine luancazarine moved this from Ready for PR Review to In Review in Component (Source and Action) Backlog Mar 17, 2026
Copy link
Copy Markdown
Contributor

@luancazarine luancazarine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @NicolasStuff, I just added some suggestions. Take a look and let me know if you have any questions.

Comment thread components/odoo/actions/create-record/create-record.mjs Outdated
Comment thread components/odoo/actions/search-read-records/search-read-records.mjs Outdated
Comment thread components/odoo/actions/update-record/update-record.mjs Outdated
@luancazarine luancazarine moved this from In Review to Changes Required in Component (Source and Action) Backlog Mar 17, 2026
michelle0927 and others added 3 commits March 20, 2026 12:13
Co-authored-by: Luan Cazarine <luanhc@gmail.com>
…s.mjs

Co-authored-by: Luan Cazarine <luanhc@gmail.com>
Co-authored-by: Luan Cazarine <luanhc@gmail.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
components/odoo/actions/create-record/create-record.mjs (1)

15-18: 🧹 Nitpick | 🔵 Trivial

Address linter warnings for the odoo prop.

The pipeline reports warnings that the odoo prop lacks label and description. While this is a pre-existing pattern, consider addressing it since you're modifying this file.

♻️ Proposed fix
     odoo: {
       ...odoo,
+      label: "Odoo",
+      description: "The Odoo app instance",
       reloadProps: true,
     },
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@components/odoo/actions/create-record/create-record.mjs` around lines 15 -
18, The linter warns that the odoo prop is missing metadata; update the prop
definition for "odoo" in create-record.mjs to include a descriptive "label" and
"description" (alongside the existing properties like reloadProps) so the prop
schema is complete; locate the object that contains the odoo key (the one
currently spreading ...odoo and setting reloadProps: true) and add meaningful
label and description fields to that prop entry.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@components/odoo/actions/search-read-records/search-read-records.mjs`:
- Around line 17-22: The model prop definition currently lacks reloadProps and
changing the model won't refresh async options for the fields prop; update the
model prop (the object with propDefinition: [odoo, "model"]) to include
reloadProps: true so that the fields prop's async options (which depend on
this.model) are reloaded when model changes.
- Line 42: The line assigning response calls this.odoo.searchAndReadRecords(...)
and exceeds the 100-char lint limit; split the call across multiple lines (e.g.,
place the method arguments on separate lines) so the const response = await
this.odoo.searchAndReadRecords( ... ) expression is wrapped under 100 characters
while preserving the same arguments (this.model, parseObject(this.filter), args)
and keeping the await and assignment to response unchanged.

---

Outside diff comments:
In `@components/odoo/actions/create-record/create-record.mjs`:
- Around line 15-18: The linter warns that the odoo prop is missing metadata;
update the prop definition for "odoo" in create-record.mjs to include a
descriptive "label" and "description" (alongside the existing properties like
reloadProps) so the prop schema is complete; locate the object that contains the
odoo key (the one currently spreading ...odoo and setting reloadProps: true) and
add meaningful label and description fields to that prop entry.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 08a9fdbc-1518-4045-b723-ad03c0fe5bb3

📥 Commits

Reviewing files that changed from the base of the PR and between 961157d and 63093f1.

📒 Files selected for processing (3)
  • components/odoo/actions/create-record/create-record.mjs
  • components/odoo/actions/search-read-records/search-read-records.mjs
  • components/odoo/actions/update-record/update-record.mjs

Comment thread components/odoo/actions/search-read-records/search-read-records.mjs
Comment thread components/odoo/actions/search-read-records/search-read-records.mjs Outdated
michelle0927 and others added 2 commits March 20, 2026 12:21
…s.mjs

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@components/odoo/package.json`:
- Line 3: Update the package.json version from 0.1.1 to 0.2.0 to reflect the new
public `model` prop feature; locate the "version" field in package.json
(currently "version": "0.1.1") and change it to "0.2.0" so the release follows
the repo's semver minor-bump policy for new features.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: d555879d-77d0-4a07-a7d7-f36808472cd1

📥 Commits

Reviewing files that changed from the base of the PR and between 63093f1 and ff9d866.

📒 Files selected for processing (2)
  • components/odoo/actions/search-read-records/search-read-records.mjs
  • components/odoo/package.json

Comment thread components/odoo/package.json
@michelle0927 michelle0927 moved this from Changes Required to Ready for PR Review in Component (Source and Action) Backlog Mar 20, 2026
@michelle0927
Copy link
Copy Markdown
Collaborator

Resolved by #20483

@github-project-automation github-project-automation Bot moved this from Ready for PR Review to Done in Component (Source and Action) Backlog Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

User submitted Submitted by a user

Development

Successfully merging this pull request may close these issues.

6 participants