Ir al contenido
Odoo Menú
  • Iniciar sesión
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • PdV para tiendas
    • PdV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en vivo
    • eLearning
    Cadena de suministro
    • Inventario
    • Manufactura
    • PLM
    • Compras
    • Mantenimiento
    • Calidad
    Recursos humanos
    • Empleados
    • Reclutamiento
    • Vacaciones
    • Evaluaciones
    • Referencias
    • Flotilla
    Marketing
    • Redes sociales
    • Marketing por correo
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyectos
    • Registro de horas
    • Servicio externo
    • Soporte al cliente
    • Planeación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Artículos
    • WhatsApp
    Aplicaciones externas Studio de Odoo Plataforma de Odoo en la nube
  • Industrias
    Venta minorista
    • Librería
    • Tienda de ropa
    • Mueblería
    • Tienda de abarrotes
    • Ferretería
    • Juguetería
    Alimentos y hospitalidad
    • Bar y pub
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidora de bebidas
    • Hotel
    Bienes inmuebles
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión de bienes inmuebles
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Firma contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Manufactura
    • Textil
    • Metal
    • Muebles
    • Comida
    • Cervecería
    • Regalos corporativos
    Salud y ejercicio
    • Club deportivo
    • Óptica
    • Gimnasio
    • Especialistas en bienestar
    • Farmacia
    • Peluquería
    Trades
    • Personal de mantenimiento
    • Hardware y soporte de TI
    • Sistemas de energía solar
    • Zapateros y fabricantes de calzado
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin fines de lucro
    • Agencia para la protección del medio ambiente
    • Alquiler de anuncios publicitarios
    • Fotografía
    • Alquiler de bicicletas
    • Distribuidor de software
    Descubre todas las industrias
  • Odoo Community
    Aprende
    • Tutoriales
    • Documentación
    • Certificaciones
    • Capacitación
    • Blog
    • Podcast
    Fortalece la educación
    • Programa educativo
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtén el software
    • Descargar
    • Compara ediciones
    • Versiones
    Colabora
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Conviértete en partner
    • Servicios para partners
    • Registra tu firma contable
    Obtén servicios
    • Encuentra un partner
    • Encuentra un contador
    • Contacta a un consultor
    • Servicios de implementación
    • Referencias de clientes
    • Soporte
    • Actualizaciones
    GitHub YouTube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicita 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
  • Proyectos
  • 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
13061 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.

Registrarse
Publicaciones relacionadas Respuestas Vistas Actividad
Search with aggregate functions in JSON-RPC?
rpc jsonrpc
Avatar
0
jun 22
2516
How to return a simple json instead object JsonRpc? (Odoo11)
json jsonrpc odoo11
Avatar
Avatar
1
sept 20
7246
Return reponse as standard json
json jsonrpc odoo12
Avatar
1
mar 20
4190
Odoo JSON Filter and Offset Parameter Resuelto
json python3 jsonrpc
Avatar
Avatar
Avatar
5
ene 20
11035
Selecting a specific db for a json request
json request jsonrpc
Avatar
0
mar 17
5346
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento en Odoo.sh
  • Soporte
  • Actualizaciones del software
  • Desarrollos personalizados
  • Educación
  • Encuentra un contador
  • Encuentra un partner
  • Conviértete en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contáctanos
  • Empleos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • 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 estar 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