Make a copy of the payment iterators

We copy the iterators created by groupby in order to prevent consumption of the
underlying iterator.

issue3660
review3321002
(transplanted from f6a75fb9052b5a3650a4230233d4dd6d478099b5)
This commit is contained in:
Nicolas Évrard committed 2014-02-10 16:17:34 +01:00
1 parent f3f9fd69e5
commit e33ec1c549
1 file changed
+2 -1
+2 -1
View File
@@ -121,7 +121,8 @@ class Letter(CompanyReport):
],
order=[('party', 'ASC'), ('id', 'ASC')]))
payments = list(chain(*payments))
return dict(groupby(payments, attrgetter('party')))
return dict((party, list(payments))
for party, payments in groupby(payments, attrgetter('party')))
@staticmethod
def get_payment_amount(payment):