From c9e32872c00e8b324a540fb2cf5045b67420b364 Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Tue, 20 Nov 2018 12:52:51 +0000 Subject: [FIX] web: list default_sort with multiple fields Define a x2m tree view with a default_sort including more than 1 field to order the list against Before this commit, the second field was never used After this commit, it is used OPW 1909785 closes odoo/odoo#28840 --- addons/web/static/src/js/views/basic/basic_model.js | 2 +- 1 file changed, 1 insertion(+), 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 0372f7cd5e7..3ee8e001258 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -4242,7 +4242,7 @@ var BasicModel = AbstractModel.extend({ if (orderData1 > orderData2) { return order.asc ? 1 : -1; } - return compareRecords(record1ID, record2ID, level + 1); + return compareRecords(resId1, resId2, level + 1); }; utils.stableSort(list.res_ids, compareRecords); } -- cgit v1.2.3 From 2e109db01b23077044e89bcffd8802c2f95c291d Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Wed, 28 Nov 2018 09:35:39 +0000 Subject: [FIX] web: context orderedBy not propagated to x2m Have: - Model A with a x2m to model B - Object A with multiple objects B in x2m (that will be sorted) - On the list view of model A, click on a column to sort by a field - this field shall not exist in B - open a record A (towards form view) Before this commit, the sorting of the x2m crashed, because the key orderedBy was propagated Due to commit e713ed2a69af9fe97fbe2d54843adc8f1ce689aa After this commit, it doesn't crash OPW 1913133 closes odoo/odoo#29094 --- addons/web/static/src/js/views/basic/basic_model.js | 2 +- 1 file changed, 1 insertion(+), 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 3ee8e001258..04a10b46442 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -3332,7 +3332,7 @@ var BasicModel = AbstractModel.extend({ model: params.modelName, offset: params.offset || (type === 'record' ? _.indexOf(res_ids, res_id) : 0), openGroupByDefault: params.openGroupByDefault, - orderedBy: params.orderedBy || (params.context && params.context.orderedBy) || [], + orderedBy: params.orderedBy || [], orderedResIDs: params.orderedResIDs, parentID: params.parentID, rawContext: params.rawContext, -- cgit v1.2.3