meta_receipt: Allow invoice as fallback documentation for checking credits.

We need this for incoming ACH where there is neither a receipt nor check.
This commit is contained in:
Brett Smith 2020-05-15 16:48:45 -04:00
parent 51db04dc20
commit 2b7c1acff4
2 changed files with 3 additions and 2 deletions

View file

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

View file

@ -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, ()),