Skip unrequested combination of account-party for balance

Same as rev bd55a6757068 but for the balance computation.

issue9762
review308741002
This commit is contained in:
Cédric Krier committed 2021-03-01 23:27:04 +01:00
1 parent 277ccfc479
commit a0574eae80
1 file changed
+6 -1
+6 -1
View File
@@ -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: