reconciler: Fix reconciler lumping unmatched books items together (#20737)
Issue was that the subset matching was passing through the grouped transactions rather than the original transactions when it failed to match.
This commit is contained in:
parent
86f4232df1
commit
5793a55dbc
2 changed files with 28 additions and 1 deletions
|
@ -503,7 +503,7 @@ def subset_match(
|
||||||
if best_match_index is not None:
|
if best_match_index is not None:
|
||||||
del statement_trans[best_match_index]
|
del statement_trans[best_match_index]
|
||||||
else:
|
else:
|
||||||
remaining_books_trans.append(r2)
|
remaining_books_trans.extend(group_items)
|
||||||
for r1 in statement_trans:
|
for r1 in statement_trans:
|
||||||
remaining_statement_trans.append(r1)
|
remaining_statement_trans.append(r1)
|
||||||
return matches, remaining_statement_trans, remaining_books_trans
|
return matches, remaining_statement_trans, remaining_books_trans
|
||||||
|
|
|
@ -350,6 +350,33 @@ def test_subset_passes_through_all_non_matches():
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def test_subset_passes_though_unmatched_transactions_with_same_payee():
|
||||||
|
# Tracy noticed that when multiple books payments had the same date and
|
||||||
|
# payee and were unmatched, they were being displayed lumped together, when
|
||||||
|
# they should have remained separate.
|
||||||
|
B1a = {
|
||||||
|
'date': datetime.date(2022, 1, 1),
|
||||||
|
'amount': decimal.Decimal('100.00'),
|
||||||
|
'payee': 'Hannah',
|
||||||
|
'check_id': '',
|
||||||
|
'filename': '2022/imports.beancount',
|
||||||
|
'line': 777,
|
||||||
|
'bank_statement': '',
|
||||||
|
}
|
||||||
|
B1b = {
|
||||||
|
'date': datetime.date(2022, 1, 1),
|
||||||
|
'amount': decimal.Decimal('100.00'),
|
||||||
|
'payee': 'Hannah',
|
||||||
|
'check_id': '',
|
||||||
|
'filename': '2022/imports.beancount',
|
||||||
|
'line': 797,
|
||||||
|
'bank_statement': '',
|
||||||
|
}
|
||||||
|
assert subset_match([], [B1a, B1b]) == (
|
||||||
|
[], [], [B1a, B1b], # No match: two preserved intact
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_handles_amex_csv():
|
def test_handles_amex_csv():
|
||||||
CSV = """Date,Receipt,Description,Card Member,Account #,Amount,Extended Details,Appears On Your Statement As,Address,City/State,Zip Code,Country,Reference,Category\n08/19/2021,,Gandi.net San Francisco,RODNEY R BROWN,-99999,28.15,"00000009999 00000009999999999999\nGandi.net\nSan Francisco\n00000009999999999999",Gandi.net San Francisco,"NEPTUNUSSTRAAT 41-63\nHOOFDDORP",,2132 JA,NETHERLANDS (THE),'999999999999999999',Merchandise & Supplies-Internet Purchase\n"""
|
CSV = """Date,Receipt,Description,Card Member,Account #,Amount,Extended Details,Appears On Your Statement As,Address,City/State,Zip Code,Country,Reference,Category\n08/19/2021,,Gandi.net San Francisco,RODNEY R BROWN,-99999,28.15,"00000009999 00000009999999999999\nGandi.net\nSan Francisco\n00000009999999999999",Gandi.net San Francisco,"NEPTUNUSSTRAAT 41-63\nHOOFDDORP",,2132 JA,NETHERLANDS (THE),'999999999999999999',Merchandise & Supplies-Internet Purchase\n"""
|
||||||
expected = [
|
expected = [
|
||||||
|
|
Loading…
Reference in a new issue