diff --git a/conservancy_beancount/plugin/meta_receivable_documentation.py b/conservancy_beancount/plugin/meta_receivable_documentation.py index beb322b..9369877 100644 --- a/conservancy_beancount/plugin/meta_receivable_documentation.py +++ b/conservancy_beancount/plugin/meta_receivable_documentation.py @@ -59,6 +59,8 @@ class MetaReceivableDocumentation(core._RequireLinksPostingMetadataHook): def _run_on_post(self, txn: Transaction, post: data.Posting) -> bool: if not post.account.is_under('Assets:Receivable'): return False + elif post.is_debit(): + return False # Get the first invoice, or return False if it doesn't exist. try: diff --git a/tests/test_meta_receivable_documentation.py b/tests/test_meta_receivable_documentation.py index 853a9ca..0843e2c 100644 --- a/tests/test_meta_receivable_documentation.py +++ b/tests/test_meta_receivable_documentation.py @@ -178,6 +178,17 @@ def test_type_errors_reported_with_valid_txn_docs(hook, invoice, support_key, su def test_received_invoices_not_checked(hook, invoice, meta_type): check(hook, None, **{meta_type: {'invoice': invoice}}) +@pytest.mark.parametrize('invoice,other_acct', testutil.combine_values( + ISSUED_INVOICE_LINKS, + ['Assets:Checking', 'Assets:Savings'], +)) +def test_paid_invoices_not_checked(hook, invoice, other_acct): + txn = testutil.Transaction(postings=[ + (TEST_ACCT, -250, {'invoice': invoice}), + (other_acct, 250), + ]) + assert not list(hook.run(txn)) + @pytest.mark.parametrize('account', [ 'Assets:Bank:Checking', 'Assets:Cash',