details:   https://code.tryton.org/tryton/commit/ff2281026e58
branch:    default
user:      Cédric Krier <[email protected]>
date:      Tue Aug 25 09:46:47 2026 +0200
description:
        Ensure to use an estimated count greater than 1 when applying log10

        Closes #15038
diffstat:

 trytond/trytond/model/fields/many2one.py |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (19 lines):

diff -r aa4a8bd85207 -r ff2281026e58 trytond/trytond/model/fields/many2one.py
--- a/trytond/trytond/model/fields/many2one.py  Tue Aug 25 09:45:59 2026 +0200
+++ b/trytond/trytond/model/fields/many2one.py  Tue Aug 25 09:46:47 2026 +0200
@@ -268,13 +268,13 @@
                     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:

Reply via email to