Skip to Content
Menu
This question has been flagged
1 Atsakyti
4472 Rodiniai

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.

 


Portretas
Atmesti
Autorius 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.


Portretas
Atmesti
Related Posts Replies Rodiniai Veikla
3
saus. 23
6255
1
vas. 22
4444
1
liep. 20
8638
1
saus. 24
2367
0
rugs. 23
27