Group zero lines by party and account

issue4122
review14451002
This commit is contained in:
Nicolas Évrard committed 2014-09-19 11:49:46 +02:00
1 parent 483a2fc404
commit 9e0f9816eb
1 file changed
+4 -2
+4 -2
View File
@@ -410,11 +410,13 @@ class Move(ModelSQL, ModelView):
move.period.post_move_sequence_used.id)
cls.write([move], values)
keyfunc = lambda l: (l.party, l.account)
to_reconcile = [l for l in move.lines
if ((l.debit == l.credit == Decimal('0'))
and l.account.reconcile)]
if to_reconcile:
Line.reconcile(to_reconcile)
to_reconcile = sorted(to_reconcile, key=keyfunc)
for _, zero_lines in groupby(to_reconcile, keyfunc):
Line.reconcile(list(zero_lines))
@classmethod
@ModelView.button