meta_receipt: Stop checking Assets:PayPal. RT#10637.

We only want to enforce paypal-id on these postings, and that's done with
the introduction of MetaPayPalID.
This commit is contained in:
Brett Smith 2020-04-07 14:47:02 -04:00
parent 21bea11beb
commit f7bb036366
2 changed files with 3 additions and 4 deletions

View file

@ -38,6 +38,7 @@ class MetaReceipt(core._RequireLinksPostingMetadataHook):
def _run_on_post(self, txn: Transaction, post: data.Posting) -> bool:
return (
(post.account.is_cash_equivalent() or post.account.is_credit_card())
and not post.account.is_under('Assets:PayPal')
and post.units.number is not None
and abs(post.units.number) >= self.payment_threshold
)
@ -71,6 +72,4 @@ class MetaReceipt(core._RequireLinksPostingMetadataHook):
keys.append('check')
elif post.account.is_credit_card() and not post.is_credit():
keys.append('invoice')
elif post.account.is_under('Assets:PayPal') and not post.is_debit():
keys.append('paypal-id')
return self._check_metadata(txn, post, keys)

View file

@ -63,8 +63,6 @@ ACCOUNTS = [AccountForTesting._make(t) for t in [
('Assets:Cash', PostType.BOTH, None),
('Assets:Checking', PostType.CREDIT, 'check'),
('Assets:Checking', PostType.DEBIT, 'check-id'),
('Assets:PayPal', PostType.CREDIT, 'paypal-id'),
('Assets:PayPal', PostType.DEBIT, None),
('Assets:Savings', PostType.BOTH, None),
('Liabilities:CreditCard', PostType.CREDIT, None),
('Liabilities:CreditCard', PostType.DEBIT, 'invoice'),
@ -84,6 +82,8 @@ KNOWN_FALLBACKS = {acct.fallback_meta for acct in ACCOUNTS if acct.fallback_meta
# doesn't require the decorated test to go over every value, which in turn
# trims unnecessary test time.
NOT_REQUIRED_ACCOUNTS = itertools.cycle([
# Only paypal-id is required for PayPal transactions
'Assets:PayPal',
'Assets:Prepaid:Expenses',
'Assets:Receivable:Accounts',
'Equity:OpeningBalance',