Passa al contenuto
Odoo Menu
  • Accedi
  • Provalo gratis
  • App
    Finanze
    • Contabilità
    • Fatturazione
    • Note spese
    • Fogli di calcolo (BI)
    • Documenti
    • Firma
    Vendite
    • CRM
    • Vendite
    • Punto vendita Negozio
    • Punto vendita Ristorante
    • Abbonamenti
    • Noleggi
    Siti web
    • Configuratore sito web
    • E-commerce
    • Blog
    • Forum
    • Live chat
    • E-learning
    Supply chain
    • Magazzino
    • Produzione
    • PLM
    • Acquisti
    • Manutenzione
    • Qualità
    Risorse umane
    • Dipendenti
    • Assunzioni
    • Ferie
    • Valutazioni
    • Referral dipendenti
    • Parco veicoli
    Marketing
    • Social marketing
    • E-mail marketing
    • SMS marketing
    • Eventi
    • Marketing automation
    • Sondaggi
    Servizi
    • Progetti
    • Fogli ore
    • Assistenza sul campo
    • Helpdesk
    • Pianificazione
    • Appuntamenti
    Produttività
    • Comunicazioni
    • Approvazioni
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    App di terze parti Odoo Studio Piattaforma cloud Odoo
  • Settori
    Retail
    • Libreria
    • Negozio di abbigliamento
    • Negozio di arredamento
    • Alimentari
    • Ferramenta
    • Negozio di giocattoli
    Cibo e ospitalità
    • Bar e pub
    • Ristorante
    • Fast food
    • Pensione
    • Grossista di bevande
    • Hotel
    Agenzia immobiliare
    • Agenzia immobiliare
    • Studio di architettura
    • Edilizia
    • Gestione immobiliare
    • Impresa di giardinaggio
    • Associazione di proprietari immobiliari
    Consulenza
    • Società di contabilità
    • Partner Odoo
    • Agenzia di marketing
    • Studio legale
    • Selezione del personale
    • Audit e certificazione
    Produzione
    • Tessile
    • Metallo
    • Arredamenti
    • Alimentare
    • Birrificio
    • Ditta di regalistica aziendale
    Benessere e sport
    • Club sportivo
    • Negozio di ottica
    • Centro fitness
    • Centro benessere
    • Farmacia
    • Parrucchiere
    Commercio
    • Tuttofare
    • Hardware e assistenza IT
    • Ditta di installazione di pannelli solari
    • Calzolaio
    • Servizi di pulizia
    • Servizi di climatizzazione
    Altro
    • Organizzazione non profit
    • Ente per la tutela ambientale
    • Agenzia di cartellonistica pubblicitaria
    • Studio fotografico
    • Punto noleggio di biciclette
    • Rivenditore di software
    Carica tutti i settori
  • Community
    Apprendimento
    • Tutorial
    • Documentazione
    • Certificazioni 
    • Formazione
    • Blog
    • Podcast
    Potenzia la tua formazione
    • Programma educativo
    • Scale Up! Business Game
    • Visita Odoo
    Ottieni il software
    • Scarica
    • Versioni a confronto
    • Note di versione
    Collabora
    • Github
    • Forum
    • Eventi
    • Traduzioni
    • Diventa nostro partner
    • Servizi per partner
    • Registra la tua società di contabilità
    Ottieni servizi
    • Trova un partner
    • Trova un contabile
    • Incontra un esperto
    • Servizi di implementazione
    • Testimonianze dei clienti
    • Supporto
    • Aggiornamenti
    GitHub Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Richiedi una demo
  • Prezzi
  • Aiuto

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Contabilità
  • Magazzino
  • PoS
  • Progetti
  • MRP
All apps
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
Assistenza

JSON-RPC - define request parameters like limit or fields

Iscriviti

Ricevi una notifica quando c'è un'attività per questo post

La domanda è stata contrassegnata
jsonrpcjsonrpc
6 Risposte
13112 Visualizzazioni
Avatar
AnJ

I'm trying to send JSON-RPC request using plain http POST request.
But I have trouble defining additional request option like limit or fields.

Here is my request body:
https://pastebin.com/1bkHb0Z3
​

And this is the response:

https://pastebin.com/ikV3X0Zy

When I'm sending a request without this additional contraint {"fields": ["id", "name", "email"]} I receive all the fields and I don't need them. 
Basically when I put anthing, like a limit or fields contraint, it returns only the record id and nothing else. Why? How to fix it?


2
Avatar
Abbandona
Avatar
Oscar Alca
Risposta migliore

You need to pass the args in the same list In your request, in the pastern you are passing separately the domain and the fields, you should pass them in the same list: 


take a look at the Odoo cookbook example \https://books.google.com.mx/books?id=4NRJDwAAQBAJ&pg=PA390&lpg=PA390&dq=jsonrpc+odoo+search_read&source=bl&ots=oj5ckTbCIP&sig=ACfU3U1rTOasUKZ2wETpvaHaZ3Z8prgYhQ&hl=en&sa=X&ved=2ahUKEwiv4IWsisHnAhUXFTQIHU0NCs0Q6AEwCXoECAwQAQ#v=onepage&q=jsonrpc odoo search_read&f=false

EDIT: 

This is the right way to do what was initally asked here https://pastebin.com/MTeE4786



1
Avatar
Abbandona
AnJ
Autore

How exactly?

I tried this:

https://pastebin.com/bS46mimc

And I'm getting an error:

"need more than 1 value to unpack"

Oscar Alca

hello, i managed to make it work like this:

https://pastebin.com/MTeE4786

If it works, do not forget to mark the answer as correct.

regards

AnJ
Autore

Thanks, that worked. But is there any documentation about order of the parameters?

How would I know (except testing it myself) that there is method, followed by record rules, then fields, then offset, then limit? Like this:

"search_read",[["id", "=", "177"]],["id", "name", "email"],0,3

In a typical xmlrpc request parametrs like limit or fields are inside object with a assigned names, so the order does not really matters.

Oscar Alca

The only way to understand the order of the parameters is by reading the code of the api, you can reffer to Odoo's official documentation but that is not always the best way to go, for example for your request you need to find the code of the search_read method.

that can be found in odoo/odoo/api.py here is the diretct link to the method https://github.com/odoo/odoo/blob/13.0/odoo/models.py#L4799

All of Odoo's ORM core methods are in that file and they are very well documented.

additionally you can take a look at this Quora explanation about positional arguments:

https://www.quora.com/What-is-a-positional-argument-in-Python-programming

hope it helps.

Avatar
Harinath Srinivasan
Risposta migliore

Hello Anj Just now I came across your Question I faced a Similar issue but I resolved it Here I paste my JSON request Body.

Creating Records:

{
    "jsonrpc": "2.0",
    "method": "call",
    "params": {
        "service": "object",
        "method": "execute",
        "args": [
            "<DB>",
            <UID>,
            "<password>",
            "library.book",
            "search_read",
            [["name", "ilike", "JSON"]],
            {"fields": ["name", "date_release"]}
        ]
    }
}
its Work if it useful for you kindly mark this also as an answer
1
Avatar
Abbandona
Ti stai godendo la conversazione? Non leggere soltanto, partecipa anche tu!

Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!

Registrati
Post correlati Risposte Visualizzazioni Attività
Search with aggregate functions in JSON-RPC?
rpc jsonrpc
Avatar
0
giu 22
2563
How to return a simple json instead object JsonRpc? (Odoo11)
json jsonrpc odoo11
Avatar
Avatar
1
set 20
7287
Return reponse as standard json
json jsonrpc odoo12
Avatar
1
mar 20
4226
Odoo JSON Filter and Offset Parameter Risolto
json python3 jsonrpc
Avatar
Avatar
Avatar
5
gen 20
11133
Selecting a specific db for a json request
json request jsonrpc
Avatar
0
mar 17
5365
Community
  • Tutorial
  • Documentazione
  • Forum
Open source
  • Scarica
  • Github
  • Runbot
  • Traduzioni
Servizi
  • Hosting Odoo.sh
  • Supporto
  • Aggiornamenti
  • Sviluppi personalizzati
  • Formazione
  • Trova un contabile
  • Trova un partner
  • Diventa nostro partner
Chi siamo
  • La nostra azienda
  • Branding
  • Contattaci
  • Lavora con noi
  • Eventi
  • Podcast
  • Blog
  • Clienti
  • Note legali • Privacy
  • Sicurezza
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo è un gestionale di applicazioni aziendali open source pensato per coprire tutte le esigenze della tua azienda: CRM, Vendite, E-commerce, Magazzino, Produzione, Fatturazione elettronica, Project Management e molto altro.

Il punto di forza di Odoo è quello di offrire un ecosistema unico di app facili da usare, intuitive e completamente integrate tra loro.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now