Skip to Content
Menu
This question has been flagged
1 Reply
3576 Views

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
Discard
Author Best Answer

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
Discard
Related Posts Replies Views Activity
3
Jan 23
4819
1
Feb 22
3824
1
Jul 20
7804
1
Jan 24
988
0
Sep 23
27