From 32197c03976d4b7c5e441a22e82ce1f8a4ae1921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 25 Aug 2026 09:46:47 +0200 Subject: [PATCH] Ensure to use an estimated count greater than 1 when applying log10 Closes #15038 (grafted from ff2281026e58f4d7a8c9823837ce16a9bb0fa09b) --HG-- branch : 8.0 --- trytond/trytond/model/fields/many2one.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trytond/trytond/model/fields/many2one.py b/trytond/trytond/model/fields/many2one.py index 6394efe9e2..9a8299632c 100644 --- a/trytond/trytond/model/fields/many2one.py +++ b/trytond/trytond/model/fields/many2one.py @@ -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: