跳至內容
選單
此問題已被標幟
1 回覆
4470 瀏覽次數

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.

 


頭像
捨棄
作者 最佳答案

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.


頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
3
1月 23
6255
1
2月 22
4444
1
7月 20
8638
1
1月 24
2367
0
9月 23
27