From 7eb9efda2da5bdf390e23979d4e582019404dbb2 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 --- payment.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/payment.py b/payment.py index 20b45340c8..b3f9440872 100644 --- a/payment.py +++ b/payment.py @@ -19,7 +19,7 @@ from trytond.model import (ModelSQL, ModelView, Workflow, fields, dualmethod, from trytond.model.exceptions import AccessError from trytond.pyson import Eval, If from trytond.transaction import Transaction -from trytond.tools import reduce_ids, grouped_slice +from trytond.tools import reduce_ids, grouped_slice, sortable_values from trytond import backend from trytond.modules.account_payment.exceptions import ProcessError @@ -268,7 +268,8 @@ class Group(metaclass=PoolMeta): Payment = pool.get('account.payment') keyfunc = self.sepa_group_payment_key # re-browse to align cache - payments = Payment.browse(sorted(self.payments, key=keyfunc)) + payments = Payment.browse(sorted( + self.payments, key=sortable_values(keyfunc))) for key, grouped_payments in groupby(payments, key=keyfunc): yield dict(key), list(grouped_payments)