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

        Same as rev bd55a6757068 but for the balance computation.

        issue9762
        review308741002
diffstat:

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

diffs (17 lines):

diff -r 1caeebedb6b6 -r 9dcbd317650a account.py
--- a/account.py        Sat Feb 27 18:16:27 2021 +0100
+++ b/account.py        Mon Mar 01 23:27:04 2021 +0100
@@ -1341,7 +1341,12 @@
                         where=account_sql & party_sql & line_query,
                         group_by=[table_a.id, line.party]))
                 for account_id, party_id, balance in cursor:
-                    id_ = account_party2id[(account_id, party_id)]
+                    try:
+                        id_ = account_party2id[(account_id, party_id)]
+                    except KeyError:
+                        # There can be more combinations of account-party in
+                        # the database than from records
+                        continue
                     balances[id_] = balance
 
         for record in records:

Reply via email to