From a0574eae8000e085579bf34160d3413f9bbe757b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 1 Mar 2021 23:27:04 +0100 Subject: [PATCH] Skip unrequested combination of account-party for balance Same as rev bd55a6757068 but for the balance computation. issue9762 review308741002 --- account.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/account.py b/account.py index 0636a59498..531b67c67a 100644 --- a/account.py +++ b/account.py @@ -1341,7 +1341,12 @@ class AccountParty(ActivePeriodMixin, ModelSQL): 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: