跳至内容
菜单
此问题已终结
1 回复
8569 查看

I want to read all records of some models through json-rpc. How should I set args?

Here is a chunk of my code:


json_endpoint = '%s/jsonrpc' % server_url
headers = {'Content-Type': 'application/json'}
def get_json_payload(service, method, *args):
return json.dumps({
​'jsonrpc': '2.0',
​'method': 'call',
​'params': {
​​'service': service,
​​'method': method,
​'args': args
​},
​'id': random.randint(0, 100000000),
})

# Read all records of model
payload = get_json_payload('object', 'execute_kw', db_name, user_id, password, 'res.partner', 'read', [?What should I set here to fetch all records?, ['id', 'name']], {'limit': 5})
res = requests.post(json_endpoint, data=payload, headers=headers).json()
print('Users data:', res['result'])

形象
丢弃
相关帖文 回复 查看 活动
1
5月 25
2444
1
4月 25
3464
1
4月 25
4290
1
4月 25
1776
4
3月 25
6876