changeset bd55a6757068 in modules/account:default
details: https://hg.tryton.org/modules/account?cmd=changeset;node=bd55a6757068
description:
        Skip unrequested combination of account-party

        When computing the debit/credit of account party, the query may return 
more
        combinations of account-party than requested.
        It is simpler to ignore them than construct a query that filter exactly 
on the
        combination of each account and party requested.

        issue9762
        review308671002
diffstat:

 account.py |  7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diffs (17 lines):

diff -r 35a3c18b040d -r bd55a6757068 account.py
--- a/account.py        Thu Nov 12 22:08:06 2020 +0100
+++ b/account.py        Fri Nov 27 22:38:34 2020 +0100
@@ -1393,7 +1393,12 @@
                         where=account_sql & party_sql & line_query,
                         group_by=[table.id, line.party]))
                 for row in cursor:
-                    id_ = account_party2id[tuple(row[0:2])]
+                    try:
+                        id_ = account_party2id[tuple(row[0:2])]
+                    except KeyError:
+                        # There can be more combinations of account-party in
+                        # the database than from records
+                        continue
                     for i, name in enumerate(names, 2):
                         # SQLite uses float for SUM
                         if not isinstance(row[i], Decimal):

Reply via email to