- 
                Notifications
    You must be signed in to change notification settings 
- Fork 32
Odoo Search Read
        Ignacio Buioli edited this page Jan 18, 2021 
        ·
        1 revision
      
    Search records by filter and get field data in just one request.
POST /odoo-api/object/search_read
| Attribute | Type | Required | Description | 
|---|---|---|---|
| model | string | yes | Odoo model | 
| filters | array | no | Odoo filter for records in search | 
| keys | object | no | Odoo key arguments | 
| db | string | yes | Odoo server DB name | 
| login | string | yes | Odoo User | 
| password | string | yes | Odoo User Password | 
import requests
import json
url = 'http://localhost:8069/odoo-api/object/search_read'
data = {'params': {'model': 'res.partner', 'filters': [('is_company', '=', True)], 'keys': {'fields': ['name'], 'limit': 5}, 'db': 'odoo', 'login': 'admin', 'password': 'admin'}}
headers = {'Content-type': 'application/json'}
r = requests.post(url, data=json.dumps(data), headers=headers)
print(r.text)this.http.post<any>('http://localhost:8069/odoo-api/object/search_read',
{params: {model: 'res.partner', filters: [['is_company', '=', true]], keys: {fields: ['name'], limit: 5}, db: 'odoo', login: 'admin', password: 'admin'}}).subscribe(data => {
    console.log(data.result);
});