From 4ea68813bdeb4f38a951cc2d1f2bc661f63eaa63 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 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/payment.py b/payment.py index 087ae58ddc..b2b897e5ef 100644 --- a/payment.py +++ b/payment.py @@ -13,6 +13,7 @@ from trytond.pyson import Eval, If from trytond.rpc import RPC from trytond.tools import reduce_ids, grouped_slice, cursor_dict from trytond.transaction import Transaction +from trytond.tools import sortable_values from trytond.wizard import Wizard, StateView, StateAction, Button from trytond.pool import Pool @@ -522,7 +523,8 @@ class ProcessPayment(Wizard): line=payment.line.rec_name)) groups = [] - payments = sorted(payments, key=self._group_payment_key) + payments = sorted( + payments, key=sortable_values(self._group_payment_key)) for key, grouped_payments in groupby(payments, key=self._group_payment_key): def group():