changeset 123ea3226846 in modules/account_tax_cash:default
details: 
https://hg.tryton.org/modules/account_tax_cash?cmd=changeset;node=123ea3226846
description:
        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
diffstat:

 account.py |  4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diffs (21 lines):

diff -r f08ddd0b1311 -r 123ea3226846 account.py
--- a/account.py        Thu Jul 09 10:21:06 2020 +0100
+++ b/account.py        Tue Jul 21 00:36:40 2020 +0200
@@ -11,6 +11,7 @@
 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 @@
         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']:

Reply via email to