How to read records using Odoo XML RPC | Read records External API
Record data is accessible via the read() method, which takes a list of ids (as returned by search() ) and optionally a list of fields to fetch. By default, it will fetch all the fields the current user can read, which tends to be a huge amount.
#odooexternalapi #xmlrpc
url = "http://localhost:8041"
db = 'test_local_enterprise_db'
username = '14'
password = '14'
import xmlrpc.client
common = xmlrpc.client.ServerProxy('{}/xmlrpc/2/common'.format(url))
version = common.version()
print("version", version)
uid = common.authenticate(db, username, password, {})
print("uid = ",uid)
models = xmlrpc.client.ServerProxy('{}/xmlrpc/2/object'.format(url))
company_record = models.execute_kw(db, uid, password,'res.partner', 'read',[company], {'fields': ['name']})
print("compnay_record",company_record)