Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
4464 Vistas

Hi Guys,

I have a working example using the XMLRPC API search_read method with just one domain filter. (First code snippet below)

However I cannot figure out how to get multiple filters in. In this case OR conditions. I have tried a few different ways but keep getting a response back saying Method Not Allowed.

Examples are coded in Java.

Working Example

List results = Arrays.asList((Object[]) models.execute("execute_kw", Arrays.asList(
db, uid, password,
"account.move", "search_read",
Arrays.asList(Arrays.asList(Arrays.asList("soic_invoice_status", "=", "ready"))),
new HashMap() {{
put("fields", Arrays.asList("name", "invoice_origin", "amount_untaxed", "amount_total", "state", "invoice_payment_state", "soic_invoice_status", "job_reference_number", "partner_id", "partner_shipping_id", "client_id"));
put("limit", 110);
}})));

Not Working

My understanding from other form posts is that the filters should be an Array/List of triples but how should the and/or operators be supplied?

List results = Arrays.asList((Object[]) models.execute("execute_kw", Arrays.asList(
db, uid, password,
"account.move", "search_read",
Arrays.asList(Arrays.asList("|", Arrays.asList("soic_invoice_status", "=", "ready"), Arrays.asList("soic_invoice_status", "=", "resubmit"))),
new HashMap() {{
put("fields", Arrays.asList("name", "invoice_origin", "amount_untaxed", "amount_total", "state", "invoice_payment_state", "soic_invoice_status", "job_reference_number", "partner_id", "partner_shipping_id", "client_id"));
put("limit", 110);
}}
)));


Any help much appreciated.

Update

Turns out the code was correct.

The  Method Not Allowed message getting returned is because something has changed with the authentication on our test server and it was no longer making it past authentication.

Test the code against another server and it works fine. Looks like Administrators hosting our server must have changed some settings.

 


Avatar
Descartar
Autor Mejor respuesta

Turns out the code was correct.

The  Method Not Allowed message getting returned is because something has changed with the authentication on our test server and it was no longer making it past authentication.

Tested the code against another server and it works fine. Looks like Administrators hosting our server must have changed some settings.


Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
3
ene 23
6255
1
feb 22
4444
1
jul 20
8635
1
ene 24
2364
0
sept 23
27