Ensure to use an estimated count greater than 1 when applying log10

Closes #15038
(grafted from ff2281026e58f4d7a8c9823837ce16a9bb0fa09b)

--HG--
branch : 8.0
This commit is contained in:
Cédric Krier
2026-08-25 09:46:47 +02:00
parent 02c2c2718a
commit 32197c0397
+2 -2
View File
@@ -262,13 +262,13 @@ class Many2One(Field):
return expression
elif (self.left and self.right
and len(ids) <= math.floor(math.log10(
Target.estimated_count() or 1))):
max(Target.estimated_count(), 1)))):
return self.convert_domain_mptt(
(name, operator, ids), tables)
elif (self.path
and (operator.endswith('parent_of')
or len(ids) <= math.floor(math.log10(
Target.estimated_count() or 1)))):
max(Target.estimated_count(), 1))))):
return self.convert_domain_path(
(name, operator, ids), tables)
else: