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: