diff options
| author | Aaron Bohy <aab@odoo.com> | 2019-03-27 13:38:46 +0000 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2019-04-02 11:57:00 +0000 |
| commit | ca19b17fd3e09d2f4e53208542f4356d3a6ee25a (patch) | |
| tree | 63b092ff0681647cfeba79db64bca051ca45ed0c /addons/web/controllers/main.py | |
| parent | d0164d834bb18f37f15a129e911f7d8e1c54b7c3 (diff) | |
[IMP] web: fetch records alongside read_group
This rev. adds params to the 'web_read_group' method, allowing to
search_read records inside each groups in a single RPC, instead of
doing a 'web_read_group' RPC followed by n 'search_read' RPCs,
where n is the number of opened groups.
Part of task 1915702
Diffstat (limited to 'addons/web/controllers/main.py')
| -rw-r--r-- | addons/web/controllers/main.py | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 98387b74106..4b78d022944 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -878,8 +878,7 @@ class DataSet(http.Controller): 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): + 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 @@ -896,22 +895,7 @@ class DataSet(http.Controller): :rtype: list """ Model = request.env[model] - - records = Model.search_read(domain, fields, - offset=offset or 0, limit=limit or False, order=sort or False) - if not records: - return { - 'length': 0, - 'records': [] - } - if limit and len(records) == limit: - length = Model.search_count(domain) - else: - length = len(records) + (offset or 0) - return { - 'length': length, - 'records': records - } + return Model.web_search_read(domain, fields, offset=offset, limit=limit, order=sort) @http.route('/web/dataset/load', type='json', auth="user") def load(self, model, id, fields): |
