From f65ae53fb27125fb22b5c4708db469ce27a3d5a5 Mon Sep 17 00:00:00 2001 From: Radhika Shyara Date: Wed, 20 Jul 2022 05:08:06 +0000 Subject: [PATCH] [FIX] mail: fix the follower subtypes order MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit, the subtypes are not correctly ordered when none of the subtypes have a parent model. while it should be order by parent model, then by sequence. So in this commit, we will first check if both their parent model are falsy then we can't order them (A = B). Then we will consider their sequence, and they will be useful to determine the proper order. task-2904015 closes odoo/odoo#96402 Signed-off-by: Sébastien Theys (seb) --- addons/mail/static/src/model/model_field_relation_set.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/mail/static/src/model/model_field_relation_set.js b/addons/mail/static/src/model/model_field_relation_set.js index 8f067af3c76..fa4a202a05d 100644 --- a/addons/mail/static/src/model/model_field_relation_set.js +++ b/addons/mail/static/src/model/model_field_relation_set.js @@ -69,6 +69,9 @@ export class RelationSet { const valB = followRelations(b, relatedPath); switch (compareMethod) { case 'truthy-first': { + if (valA === valB) { + break; + } if (!valA) { return 1; } @@ -78,6 +81,9 @@ export class RelationSet { break; } case 'falsy-first': { + if (valA === valB) { + break; + } if (!valA) { return -1; }