From 8943aae665ea906aa03bc30cada884c571738b7c Mon Sep 17 00:00:00 2001 From: Martin Geubelle Date: Fri, 28 Apr 2017 14:31:21 +0200 Subject: [FIX] web: deal wih `default_order` attribute One could set the attribute `default_order` in the view arch (like 'name,id desc'). The records should then be sorted accordingly. This feature was not implemented in the new views. This attribute should work on both basic views and embedded views (x2many). The former uses the `sort` argument in `search_read` while the latter is sorted client-side. There is however a potential issue with the latter: as the order is done client-side with records received by the server, if there are more records than the limit, the server will send records without any order. The client side order will thus be done on a fraction of the records. --- addons/web/static/src/js/views/basic/basic_model.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'addons/web/static/src/js/views/basic/basic_model.js') diff --git a/addons/web/static/src/js/views/basic/basic_model.js b/addons/web/static/src/js/views/basic/basic_model.js index ef93028eeba..f7026f27129 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -37,7 +37,7 @@ odoo.define('web.BasicModel', function (require) { * model: {string, * offset: {integer}, * openGroupByDefault: {boolean}, - * orderedBy: {string[]}, + * orderedBy: {Object[]}, * parentID: {string}, * rawContext: {Object}, * relationField: {string}, @@ -1621,6 +1621,7 @@ var BasicModel = AbstractModel.extend({ res_ids: ids, static: true, type: 'list', + orderedBy: fieldInfo.orderedBy, parentID: record.id, rawContext: rawContext, relationField: field.relation_field, -- cgit v1.2.3