Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
7248 Vizualizări

Hi,

How can I find the description of all RPC method ? The below links didn't give all option of the search_read

 method, nor the url to call: /web/dataset/search_read

https://www.odoo.com/documentation/9.0/api_integration.html

http://odoo-new-api-guide-line.readthedocs.org/en/latest/environment.html#search-re

I am looking for something lile:

Call URL: http://37.187.122.134:8069/web/dataset/search_read

Method: POST

Mandatory field:

- model:res.partner

-field: name

Optional field:

- domain

....



Call: 

Imagine profil
Abandonează
Cel mai bun răspuns

This is  the code you are looking for  def search_read(self, model, fields=False, offset=0, limit=False, domain=None, sort=None):

class DataSet(http.Controller):
@http.route('/web/dataset/search_read', type='json', auth="user")
def search_read(self, model, fields=False, offset=0, limit=False, domain=None, sort=None):
return self.do_search_read(model, fields, offset, limit, domain, sort)
def do_search_read(self, model, fields=False, offset=0, limit=False, domain=None
, sort=None):
""" Performs a search() followed by a read() (if needed) using the
provided search criteria
:param str model: the name of the model to search on
:param fields: a list of the fields to return in the result records
:type fields: [str]
:param int offset: from which index should the results start being returned
:param int limit: the maximum number of records to return
:param list domain: the search domain for the query
:param list sort: sorting directives
:returns: A structure (dict) with two keys: ids (all the ids matching
the (domain, context) pair) and records (paginated records
matching fields selection set)
:rtype: list
"""
Model = request.session.model(model)
records = Model.search_read(domain, fields, offset or 0, limit or False, sort or False,
request.context)
if not records:
return {
'length': 0,
'records': []
}
if limit and len(records) == limit:
length = Model.search_count(domain, request.context)
else:
length = len(records) + (offset or 0)
return {
'length': length,
'records': records
}
Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
3
mar. 23
4443
0
iul. 21
1874
0
oct. 18
3098
1
ian. 23
2787
0
dec. 21
3198