summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/core/rpc.js
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2019-03-13 15:42:52 +0000
committerAaron Bohy <aab@odoo.com>2019-04-02 11:55:57 +0000
commit2be28d4d033b5930e5a16ff02407315a116e9043 (patch)
tree0561dbbf8c127d0aea94c6766c6815fe1d1f2d83 /addons/web/static/src/js/core/rpc.js
parent5895d23cbd26beb3bc3c83cc760b3cdbb64b0e85 (diff)
[IMP] web,board: enable pagination in grouped lists
With this rev., when there are a lot of groups in a grouped list view, groups are displayed under several pages, whereas they were all displayed in the same page before. This is especially interesting with the new 'expand' attribute, to ensure that we don't read records for a large number of groups. By default, the groups limit is set to 80 (like records), and to 10 is the 'expand' attribute is set to true. This limit can be overriden with the 'groups_limit' attribute. Part of task 1915702
Diffstat (limited to 'addons/web/static/src/js/core/rpc.js')
-rw-r--r--addons/web/static/src/js/core/rpc.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/addons/web/static/src/js/core/rpc.js b/addons/web/static/src/js/core/rpc.js
index 21ec43e3d95..802f7082cad 100644
--- a/addons/web/static/src/js/core/rpc.js
+++ b/addons/web/static/src/js/core/rpc.js
@@ -37,6 +37,7 @@ return {
buildQuery: function (options) {
var route;
var params = options.params || {};
+ var orderBy;
if (options.route) {
route = options.route;
} else if (options.model && options.method) {
@@ -50,7 +51,7 @@ return {
params.kwargs.context = options.context || params.context || params.kwargs.context;
}
- if (options.method === 'read_group') {
+ if (options.method === 'read_group' || options.method === 'web_read_group') {
if (!(params.args && params.args[0] !== undefined)) {
params.kwargs.domain = options.domain || params.domain || params.kwargs.domain || [];
}
@@ -64,7 +65,7 @@ return {
params.kwargs.limit = options.limit || params.limit || params.kwargs.limit;
// In kwargs, we look for "orderby" rather than "orderBy" (note the absence of capital B),
// since the Python argument to the actual function is "orderby".
- var orderBy = options.orderBy || params.orderBy || params.kwargs.orderby;
+ orderBy = options.orderBy || params.orderBy || params.kwargs.orderby;
params.kwargs.orderby = orderBy ? this._serializeSort(orderBy) : orderBy;
params.kwargs.lazy = 'lazy' in options ? options.lazy : params.lazy;
}
@@ -77,7 +78,7 @@ return {
params.kwargs.limit = options.limit || params.limit || params.kwargs.limit;
// In kwargs, we look for "order" rather than "orderBy" since the Python
// argument to the actual function is "order".
- var orderBy = options.orderBy || params.orderBy || params.kwargs.order;
+ orderBy = options.orderBy || params.orderBy || params.kwargs.order;
params.kwargs.order = orderBy ? this._serializeSort(orderBy) : orderBy;
}
@@ -88,7 +89,7 @@ return {
params.fields = options.fields || params.fields;
params.limit = options.limit || params.limit;
params.offset = options.offset || params.offset;
- var orderBy = options.orderBy || params.orderBy;
+ orderBy = options.orderBy || params.orderBy;
params.sort = orderBy ? this._serializeSort(orderBy) : orderBy;
params.context = options.context || params.context || {};
}