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
This commit is contained in:
Cédric Krier
2020-07-21 00:36:40 +02:00
parent 9b21559ba5
commit 4ea68813bd
+3 -1
View File
@@ -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():