changeset 63fdf00aa263 in modules/account:5.8
details: https://hg.tryton.org/modules/account?cmd=changeset&node=63fdf00aa263
description:
        Skip unrequested combination of account-party for balance

        Same as rev bd55a6757068 but for the balance computation.

        issue9762
        review308741002
        (grafted from 9dcbd317650adbb20e785c9f367d89dd6ea60261)
diffstat:

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

diffs (17 lines):

diff -r d815ac7c3f45 -r 63fdf00aa263 account.py
--- a/account.py        Fri Jan 01 16:16:45 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