From 5438cb2f452a2f9f87682995708713dd850f83bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 23 Mar 2021 23:48:32 +0100 Subject: [PATCH] Ignore selection length deviating twice from the standard deviation issue10089 review332251002 --- tryton/common/selection.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tryton/common/selection.py b/tryton/common/selection.py index f98ee2ad44..5544640fba 100644 --- a/tryton/common/selection.py +++ b/tryton/common/selection.py @@ -170,7 +170,10 @@ class PopdownMixin(object): deviation = int( math.sqrt(sum((x - average) ** 2 for x in pop) / len(pop))) - width = max(next((x for x in pop if x < (deviation * 4)), 10), 10) + width = max(next( + (x for x in pop if abs(x - average) < (deviation * 2)), + 10), + 10) else: width = 10 child.set_width_chars(width)