From f5730e2a6a4af05b506aba985e8283feb3ca789e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 21 Jul 2020 00:36:40 +0200 Subject: [PATCH] Ensure values can be sorted The values may contain None which is not orderable so we insert a third argument before the value to prevent to compare None value against others. issue9381 review303881005 --- account.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/account.py b/account.py index 3dd00ddb83..9a3b059d5e 100644 --- a/account.py +++ b/account.py @@ -11,6 +11,7 @@ from trytond.model import ModelSQL, ModelView, Workflow, fields from trytond.pool import PoolMeta, Pool from trytond.pyson import Eval from trytond.transaction import Transaction +from trytond.tools import sortable_values from .exceptions import ClosePeriodWarning @@ -160,7 +161,8 @@ class TaxLine(metaclass=PoolMeta): if not lines: return to_save = [] - lines = cls.browse(sorted(lines, key=cls.group_cash_basis_key)) + lines = cls.browse(sorted( + lines, key=sortable_values(cls.group_cash_basis_key))) for key, lines in groupby(lines, key=cls.group_cash_basis_key): key = dict(key) if not key['on_cash_basis']: