There's more...

Similar to XML-RPC, you can use the search_read() method instead of the search() and read() method combination as it is slightly time-consuming. The following is an alternative way to fetch book data with search_read(). It will return the same output as in the previous example:

# place authentication and get_json_payload methods (see first jsonrpc recipe)

if user_id:
# search and read for the books ids
search_domain = ['|', ['name', 'ilike', 'odoo'], ['name', 'ilike', 'sql']]
payload = get_json_payload("object", "execute_kw",
db_name, user_id, password,
'library.book', 'search_read', [search_domain, ['name', 'date_release']],
{'limit': 5})
res = requests.post(json_endpoint, data=payload, headers=headers).json()
print('Books data:', res)
else:
print("Failed: wrong credentials")
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset