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:
		
							parent
							
								
									21bea11beb
								
							
						
					
					
						commit
						f7bb036366
					
				
					 2 changed files with 3 additions and 4 deletions
				
			
		| 
						 | 
					@ -38,6 +38,7 @@ class MetaReceipt(core._RequireLinksPostingMetadataHook):
 | 
				
			||||||
    def _run_on_post(self, txn: Transaction, post: data.Posting) -> bool:
 | 
					    def _run_on_post(self, txn: Transaction, post: data.Posting) -> bool:
 | 
				
			||||||
        return (
 | 
					        return (
 | 
				
			||||||
            (post.account.is_cash_equivalent() or post.account.is_credit_card())
 | 
					            (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 post.units.number is not None
 | 
				
			||||||
            and abs(post.units.number) >= self.payment_threshold
 | 
					            and abs(post.units.number) >= self.payment_threshold
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
| 
						 | 
					@ -71,6 +72,4 @@ class MetaReceipt(core._RequireLinksPostingMetadataHook):
 | 
				
			||||||
            keys.append('check')
 | 
					            keys.append('check')
 | 
				
			||||||
        elif post.account.is_credit_card() and not post.is_credit():
 | 
					        elif post.account.is_credit_card() and not post.is_credit():
 | 
				
			||||||
            keys.append('invoice')
 | 
					            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)
 | 
					        return self._check_metadata(txn, post, keys)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -63,8 +63,6 @@ ACCOUNTS = [AccountForTesting._make(t) for t in [
 | 
				
			||||||
    ('Assets:Cash', PostType.BOTH, None),
 | 
					    ('Assets:Cash', PostType.BOTH, None),
 | 
				
			||||||
    ('Assets:Checking', PostType.CREDIT, 'check'),
 | 
					    ('Assets:Checking', PostType.CREDIT, 'check'),
 | 
				
			||||||
    ('Assets:Checking', PostType.DEBIT, 'check-id'),
 | 
					    ('Assets:Checking', PostType.DEBIT, 'check-id'),
 | 
				
			||||||
    ('Assets:PayPal', PostType.CREDIT, 'paypal-id'),
 | 
					 | 
				
			||||||
    ('Assets:PayPal', PostType.DEBIT, None),
 | 
					 | 
				
			||||||
    ('Assets:Savings', PostType.BOTH, None),
 | 
					    ('Assets:Savings', PostType.BOTH, None),
 | 
				
			||||||
    ('Liabilities:CreditCard', PostType.CREDIT, None),
 | 
					    ('Liabilities:CreditCard', PostType.CREDIT, None),
 | 
				
			||||||
    ('Liabilities:CreditCard', PostType.DEBIT, 'invoice'),
 | 
					    ('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
 | 
					# doesn't require the decorated test to go over every value, which in turn
 | 
				
			||||||
# trims unnecessary test time.
 | 
					# trims unnecessary test time.
 | 
				
			||||||
NOT_REQUIRED_ACCOUNTS = itertools.cycle([
 | 
					NOT_REQUIRED_ACCOUNTS = itertools.cycle([
 | 
				
			||||||
 | 
					    # Only paypal-id is required for PayPal transactions
 | 
				
			||||||
 | 
					    'Assets:PayPal',
 | 
				
			||||||
    'Assets:Prepaid:Expenses',
 | 
					    'Assets:Prepaid:Expenses',
 | 
				
			||||||
    'Assets:Receivable:Accounts',
 | 
					    'Assets:Receivable:Accounts',
 | 
				
			||||||
    'Equity:OpeningBalance',
 | 
					    'Equity:OpeningBalance',
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue