From 2b7c1acff47b334be9e53a11847da3e62dbdd3e4 Mon Sep 17 00:00:00 2001 From: Brett Smith Date: Fri, 15 May 2020 16:48:45 -0400 Subject: [PATCH] meta_receipt: Allow invoice as fallback documentation for checking credits. We need this for incoming ACH where there is neither a receipt nor check. --- conservancy_beancount/plugin/meta_receipt.py | 1 + tests/test_meta_receipt.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/conservancy_beancount/plugin/meta_receipt.py b/conservancy_beancount/plugin/meta_receipt.py index c620579..4c2c9b9 100644 --- a/conservancy_beancount/plugin/meta_receipt.py +++ b/conservancy_beancount/plugin/meta_receipt.py @@ -69,6 +69,7 @@ class MetaReceipt(core._RequireLinksPostingMetadataHook): return self._run_checking_debit(txn, post) elif is_checking: keys.append('check') + keys.append('invoice') elif post.account.is_credit_card() and post.units.number <= 0: keys.append('invoice') return self._check_metadata(txn, post, keys) diff --git a/tests/test_meta_receipt.py b/tests/test_meta_receipt.py index e480ff5..842064e 100644 --- a/tests/test_meta_receipt.py +++ b/tests/test_meta_receipt.py @@ -59,10 +59,10 @@ class AccountForTesting(typing.NamedTuple): ACCOUNTS = [AccountForTesting._make(t) for t in [ - ('Assets:Bank:CheckCard', PostType.CREDIT, ('check',)), + ('Assets:Bank:CheckCard', PostType.CREDIT, ('check', 'invoice')), ('Assets:Bank:CheckCard', PostType.DEBIT, ('check-id',)), ('Assets:Cash', PostType.BOTH, ()), - ('Assets:Checking', PostType.CREDIT, ('check',)), + ('Assets:Checking', PostType.CREDIT, ('check', 'invoice')), ('Assets:Checking', PostType.DEBIT, ('check-id',)), ('Assets:Savings', PostType.BOTH, ()), ('Liabilities:CreditCard', PostType.CREDIT, ()),