meta_receivable_docs: Not required for paid receivables. RT#10634.
This commit is contained in:
parent
f24f941cfb
commit
4437a130d6
2 changed files with 13 additions and 0 deletions
|
@ -59,6 +59,8 @@ class MetaReceivableDocumentation(core._RequireLinksPostingMetadataHook):
|
||||||
def _run_on_post(self, txn: Transaction, post: data.Posting) -> bool:
|
def _run_on_post(self, txn: Transaction, post: data.Posting) -> bool:
|
||||||
if not post.account.is_under('Assets:Receivable'):
|
if not post.account.is_under('Assets:Receivable'):
|
||||||
return False
|
return False
|
||||||
|
elif post.is_debit():
|
||||||
|
return False
|
||||||
|
|
||||||
# Get the first invoice, or return False if it doesn't exist.
|
# Get the first invoice, or return False if it doesn't exist.
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -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):
|
def test_received_invoices_not_checked(hook, invoice, meta_type):
|
||||||
check(hook, None, **{meta_type: {'invoice': invoice}})
|
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', [
|
@pytest.mark.parametrize('account', [
|
||||||
'Assets:Bank:Checking',
|
'Assets:Bank:Checking',
|
||||||
'Assets:Cash',
|
'Assets:Cash',
|
||||||
|
|
Loading…
Reference in a new issue