Ir al contenido
Odoo Menú
  • Identificarse
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • TPV para tiendas
    • TPV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en directo
    • eLearning
    Cadena de suministro
    • Inventario
    • Fabricación
    • PLM
    • Compra
    • Mantenimiento
    • Calidad
    Recursos Humanos
    • Empleados
    • Reclutamiento
    • Ausencias
    • Evaluación
    • Referencias
    • Flota
    Marketing
    • Marketing social
    • Marketing por correo electrónico
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyecto
    • Partes de horas
    • Servicio de campo
    • Servicio de asistencia
    • Planificación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Conocimientos
    • WhatsApp
    Aplicaciones de terceros Studio de Odoo Plataforma de Odoo Cloud
  • Industrias
    Comercio al por menor
    • Librería
    • Tienda de ropa
    • Tienda de muebles
    • Tienda de ultramarinos
    • Ferretería
    • Juguetería
    Alimentación y hostelería
    • Bar y taberna
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidor de bebidas
    • Hotel
    Inmueble
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión inmobiliaria
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Empresa contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Fabricación
    • Textil
    • Metal
    • Muebles
    • Alimentos
    • Brewery
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Oficios
    • Handyman
    • Hardware y asistencia informática
    • Sistemas de energía solar
    • Zapatero
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin ánimo de lucro
    • Agencia de protección del medio ambiente
    • Alquiler de paneles publicitarios
    • Estudio fotográfico
    • Alquiler de bicicletas
    • Distribuidor de software
    Browse all Industries
  • Comunidad
    Aprender
    • Tutoriales
    • Documentación
    • Certificaciones
    • Formación
    • Blog
    • Podcast
    Potenciar la educación
    • Programa de formación
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtener el software
    • Descargar
    • Comparar ediciones
    • Versiones
    Colaborar
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Convertirse en partner
    • Services for Partners
    • Registrar tu empresa contable
    Obtener servicios
    • Encontrar un partner
    • Encontrar un asesor fiscal
    • Contacta con un experto
    • Servicios de implementación
    • Referencias de clientes
    • Ayuda
    • Actualizaciones
    GitHub YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicitar una demostración
  • Precios
  • Ayuda

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

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyecto
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

JSON-RPC - define request parameters like limit or fields

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
jsonrpcjsonrpc
6 Respuestas
13070 Vistas
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
Descartar
Avatar
Oscar Alca
Mejor respuesta

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
Descartar
AnJ
Autor

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
Autor

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
Mejor respuesta

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
Descartar
¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Inscribirse
Publicaciones relacionadas Respuestas Vistas Actividad
Search with aggregate functions in JSON-RPC?
rpc jsonrpc
Avatar
0
jun 22
2520
How to return a simple json instead object JsonRpc? (Odoo11)
json jsonrpc odoo11
Avatar
Avatar
1
sept 20
7259
Return reponse as standard json
json jsonrpc odoo12
Avatar
1
mar 20
4195
Odoo JSON Filter and Offset Parameter Resuelto
json python3 jsonrpc
Avatar
Avatar
Avatar
5
ene 20
11055
Selecting a specific db for a json request
json request jsonrpc
Avatar
0
mar 17
5347
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento Odoo.sh
  • Ayuda
  • Actualizar
  • Desarrollos personalizados
  • Educación
  • Encontrar un asesor fiscal
  • Encontrar un partner
  • Convertirse en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contacta con nosotros
  • Puestos de trabajo
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Información legal • Privacidad
  • Seguridad
الْعَرَبيّة 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 es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y totalmente integrado.

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