meta_approval: Not required for chargebacks. RT#10978.
This commit is contained in:
parent
23e1ed7cee
commit
e429a6c6fd
2 changed files with 12 additions and 4 deletions
|
@ -44,4 +44,8 @@ class MetaApproval(core._RequireLinksPostingMetadataHook):
|
|||
)
|
||||
|
||||
def _run_on_post(self, txn: Transaction, post: data.Posting) -> bool:
|
||||
return post.account.is_cash_equivalent() and post.units.number < 0
|
||||
return (
|
||||
post.account.is_cash_equivalent()
|
||||
and post.units.number < 0
|
||||
and post.meta.get('tax-implication', '').title() != 'Chargeback'
|
||||
)
|
||||
|
|
|
@ -159,10 +159,14 @@ def test_approval_not_required_to_pay_credit_card(hook):
|
|||
])
|
||||
assert not list(hook.run(txn))
|
||||
|
||||
def test_approval_not_required_for_asset_transfers(hook):
|
||||
@pytest.mark.parametrize('tax_implication,other_acct', [
|
||||
('Bank-Transfer', 'Assets:Savings'),
|
||||
('Chargeback', 'Income:Donations'),
|
||||
])
|
||||
def test_approval_not_required_for_asset_transfers(hook, tax_implication, other_acct):
|
||||
txn = testutil.Transaction(postings=[
|
||||
('Assets:Checking', -250, {'tax-implication': 'Bank-Transfer'}),
|
||||
('Assets:Savings', 250),
|
||||
('Assets:Checking', -250, {'tax-implication': tax_implication}),
|
||||
(other_acct, 250),
|
||||
])
|
||||
assert not list(hook.run(txn))
|
||||
|
||||
|
|
Loading…
Reference in a new issue