meta_receivable_docs: Not required for paid receivables. RT#10634.

This commit is contained in:
Brett Smith 2020-04-05 15:06:10 -04:00
parent f24f941cfb
commit 4437a130d6
2 changed files with 13 additions and 0 deletions

View file

@ -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:

View file

@ -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',