Take the first item of single value only with 'in' operator
Closes #13403 (grafted from d826376d08a50b415a2c4b878a2c7652f1f2083b) --HG-- branch : 7.0
This commit is contained in:
1 parent
a85ba40c9f
commit
1798e57775
2 files changed
+5
-2
No files matched your search
+3
-1
@@ -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];
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in new issue
Block a user