コンテンツへスキップ
メニュー
この質問にフラグが付けられました
3 返信
7879 ビュー

I am an android developer who is now working with OODO API. My aim is to read a specific amount of data present in the res.partner object in the OpenERP.

I used the below code to get all the data's present in the res.partner object.

  String[] arrayOfString4 = new String[4];

  arrayOfString4[0] = "name";

  arrayOfString4[1] = "date";

  arrayOfString4[2] = "state_id";

  arrayOfString4[3] = "ho_branch_id";

  arrayOfString4[4] = "client_id";

  tableId = (Object[]) client1.call("execute", DB_NAME, UID, PASSWORD, "res.partner", "search", new Object[0]); Object[]      

 tableitems = (Object[]) client1.call("execute", DB_NAME, UID, PASSWORD, "res.partner", "read", tableId, arrayOfString4);

This code retrieves more than 20,000 data's where I only need the first 50 data's. I checked this OODO API link for a solution.And from there I tried this.

tableId = (Object[]) client1.call("execute", DB_NAME, UID, PASSWORD, "res.partner", "search", new Object[0],new HashMap() {{ put("limit",50); }});

Object[] tableitems = (Object[]) client1.call("execute", DB_NAME, UID, PASSWORD, "res.partner", "read", tableId, arrayOfString4);

But I get an error java.lang.string cannot be converted into java.lang.integer Can anyone please help me how to limit the number of data's read??? I hope my question is clear enough..I am new at this. Thank you.

アバター
破棄
Hi.

I'm sorry...I am new to the oodo forum....Could you tell me if you answered my question??
I cannot find the answer in the page where I posted my question.

Thank you.

 

On Tue, Feb 21, 2017 at 12:45 PM, Ermin Trevisan <trevi@twanda.com> wrote:

A new question How to limit reading data in XMLRPC android on Help has been posted. Click here to access the question :

See question

--
Ermin Trevisan


Sent by Odoo S.A. using Odoo.


最善の回答

which API are you using ??

 is it Odoo External Api ??.


In the Odoo External Api Documentation is explaining that ,  you can set the limit for the reading Records in Read and Search_read methods ,  and you can set the offset and the limit if need . refer the link

https://www.odoo.com/documentation/11.0/webservices/odoo.html

アバター
破棄
最善の回答

use fields as this example :

def getConvert(self, partner_id):
    modelName = 'membership.membership.line'                       
    domain = [ ('partner_id','=',partner_id )]       
    fields =[
            'id',
             'partner_id',
             'name', ]
        user = self.execute(modelName, 'search_read',    [domain,    fields])
        try :
            userId = user[0]['id']
            logger.info("converted ParterId :" + str(partner_id)+ " == UserId ids : " + str(userId))
        except IndexError as e:
            logger.warn(str(e) + "can not converted - no UserId for Partner:" + str(partner_id))
            userId = False
        return  userId

アバター
破棄
関連投稿 返信 ビュー 活動
0
8月 16
5073
1
3月 17
4663
0
11月 15
3401
3
7月 25
2758
1
10月 24
1968