From 1798e5777580b56d1d4444fc4a95ac626e61b4e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 28 Oct 2024 00:39:53 +0100 Subject: [PATCH] Take the first item of single value only with 'in' operator Closes #13403 (grafted from d826376d08a50b415a2c4b878a2c7652f1f2083b) --HG-- branch : 7.0 --- sao/src/common.js | 4 +++- tryton/tryton/common/domain_inversion.py | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/sao/src/common.js b/sao/src/common.js index 84f5cd3153..c614eb2687 100644 --- a/sao/src/common.js +++ b/sao/src/common.js @@ -2793,7 +2793,9 @@ (single_value && operator == 'in' && value.length == 1)) && (!count || ((count === 1) && model.length && name.endsWith('.id')))) { - value = operator == '=' ? value : value[0]; + if ((operator == 'in') && single_value) { + value = value[0]; + } if (model.length && name.endsWith('.id')) { model = model[0]; value = [model, value]; diff --git a/tryton/tryton/common/domain_inversion.py b/tryton/tryton/common/domain_inversion.py index efbf0735c0..97bc0a9015 100644 --- a/tryton/tryton/common/domain_inversion.py +++ b/tryton/tryton/common/domain_inversion.py @@ -433,7 +433,8 @@ def unique_value(domain, single_value=True): and operator == 'in' and len(value) == 1)) and (not count or (count == 1 and model and name.endswith('.id')))): - value = value if operator == '=' and single_value else value[0] + if operator == 'in' and single_value: + value = value[0] if model and name.endswith('.id'): model = model[0] value = [model, value]