details:   https://code.tryton.org/tryton/commit/6a9cdef17df8
branch:    8.0
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
        (grafted from ff2281026e58f4d7a8c9823837ce16a9bb0fa09b)
diffstat:

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

diffs (19 lines):

diff -r 32978a372dc5 -r 6a9cdef17df8 trytond/trytond/model/fields/many2one.py
--- a/trytond/trytond/model/fields/many2one.py  Thu Aug 06 13:09:48 2026 +0200
+++ b/trytond/trytond/model/fields/many2one.py  Tue Aug 25 09:46:47 2026 +0200
@@ -262,13 +262,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