Odoo adapter: fix create, write, method kwargs and the connection test - #822
Merged
Merged
Conversation
Tested against a live Odoo 19 (JSON-2 API). Reads worked; everything that
writes failed with 422, and real users hit it:
- odoo_create sent {values}; Odoo's create takes vals_list.
- odoo_write sent {values}; Odoo's write takes vals.
- odoo_call_method nested the arguments under "kwargs", but JSON-2 binds
every top-level body key to a method parameter. A new `__merge` key in
bodyMapping spreads an object argument into the top level of the body
(explicit keys win, prototype keys rejected).
- odoo_search_count needs a domain; it is now required ([] counts all).
- The connection test sends GET, and /json/2 only answers POST (404). It
now reads the bearer-authenticated API doc of a small model, which also
rejects a wrong key with 401.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tested the catalog Odoo adapter against a live Odoo 19 Enterprise instance through the real RestEngine. Reads (partners, sale orders, invoices, products, search_read, read, fields_get, search_count) worked. Every write failed with 422, and two Cloud workspaces that installed the connector today hit exactly these errors.
{values}; Odoo'screatetakesvals_list{"vals_list": [values]}, returns[id]{values};writetakesvals{"ids", "vals"}kwargs; JSON-2 binds each top-level key to a parameter__mergein bodyMapping spreads them to the top leveldomainis a required argumentdomainrequired in the schema/json/2is POST only/doc-bearer/res.country.state.json(bearer-checked, 401 on a wrong key)__merge(rest.engine.tsmapParams): an object argument whose keys become top-level body keys. Explicit keys win;__proto__/constructor/prototypeare rejected like in bodyTemplate.Live run after the fix: create → write → read →
activity_schedulewith summary and deadline → the activity is there → unlink, all OK; the test record was removed.